Using Polymer Web Components and Rails

97 views
Skip to first unread message

Andrew Huth

unread,
Feb 27, 2014, 1:30:44 PM2/27/14
to rubyonra...@googlegroups.com
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.

Frederick Cheung

unread,
Feb 28, 2014, 6:57:31 AM2/28/14
to rubyonra...@googlegroups.com
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

Andrew Huth

unread,
Mar 1, 2014, 11:56:31 PM3/1/14
to rubyonra...@googlegroups.com
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 `<!-- require "whatever" -->. 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.

Alex Chaplinsky

unread,
Jul 7, 2014, 1:56:58 PM7/7/14
to rubyonra...@googlegroups.com
Actually there is a ruby gem, which allows you to create Web Components
in RoR application using Polymer
https://github.com/alchapone/polymer-rails

--
Posted via http://www.ruby-forum.com/.
Reply all
Reply to author
Forward
0 new messages