Rails and Web Components Part 1: Adding Polymer to a Rails App
My horizons were expanded a little bit by Dane O'Connor’s recent talk on web components and Polymer at Software As Craft Philadelphia. Not knowing much about web components, I didn’t realize there was such an elegant way to encapsulate the related JavaScript, CSS, and HTML for a single piece of a website’s behavior without having to manipulate global state. That’s a huge improvement to the state of the art for front-end development, and I immediately wondered how easy it would be to start including this stuff in some of my current Rails projects.
If you’re not already familiar with the basic idea of web components and how they work from a purely front-end perspective, take a look at the introduction on the Polymer site. Otherwise, read on to learn about the mostly painless process I used to get web components up and running in an existing Rails app.