Using Polymer Web Components and Rails

I’m trying to come up with a way to use polymer with Rails, but there isn’t much out there on the subject.

My thoughts are to handle web components like Javascript or CSS in rails. There will be an ‘app/assets/elements/application.html’ which defines what elements you want to be included. Then the asset pipeline needs to pull out dependencies for those elements and import them first. I also imagine in production all the web components will be concatenated into one html import.

The only problem is, I have no idea where to start on developing this. Is this something people want to see, and does anybody have any pointers on how to get started?

So far, I’ve asked a question on StackOverflow that is really basic, but it received any answers.

Anyway, your thoughts are appreciated.

Perhaps look at the jquery-ui-rails gem - It’s similar in that you say which components you want and it includes the dependencies for you (you do have to repeat this for both css and js though).

You’ll probably want to look into sprockets too, since that is what is behind the asset pipeline.

Fred

Yeah, I’ve been looking at the sprockets source. I need to come up with a way of creating a new type of manifest file to load the web components.

Just like we specify javascript in application.js with //= require "whatever, I need an application.html with `. Then sprockets needs to create an html import for each file specified in the manifest.

Unfortunately, I really have no idea where to begin. I’ll keep reading the sprockets source, but its way over my head. Thanks for your input, though.

Actually there is a ruby gem, which allows you to create Web Components
in RoR application using Polymer
https://github.com/alchapone/polymer-rails