At first I tried to use web components with bower-rails and emcee .
But I noticed that bower-rails is not required, you just need to configure .bowerrc and bower.json, then run the bower installation.
In addition, emcee is no longer active, which forces you to use an older version of stars.
It turns out polymer-rails has the same functionality as emcee.
Here is my current setup
Gemfile
gem 'polymer-rails'
set and initialize
bundle install rails g polymer:install
application / views / layouts / application.html.erb
<html> <head> ... <%= html_import_tag 'application'%> ...
Download the bower.json file from elements.polymer-project.org and put it in the root of your application, then run the command
bower install
Your components should now be in the supplier / assets / components. Locate all .html files to include in the manifest. Some of the .html files are not the same name as the directory, so it is a little tedious.
Application / assets / components / application.html.erb
//= require polymer/polymer //= require paper-scroll-header-panel/paper-scroll-header-panel //= require paper-toolbar/paper-toolbar //= require paper-tabs/paper-tabs //= require paper-drawer-panel/paper-drawer-panel //= require paper-icon-button/paper-icon-button //= require iron-icons/iron-icons //= require paper-card/paper-card //= require paper-button/paper-button ...
Now make sure the stars are loading assets
configurations / Initializers / assets.rb
Rails.application.config.assets.paths << Rails.root.join('vendor', 'assets', 'components', '*')
Here is an example using the component
<paper-card heading="Paper Card Example" image="<%= image_path 'example.jpg' %>"> <div class="card-content">This is an example of cards with polymer</div> <div class="card-actions"> <paper-button raised>OK</paper-button> </div> </paper-card>
You can use polymer rail elements that already have many components, and you can skip the bower.json, bower install, and load assets settings. The only problem was that it was difficult for me to find out which ones were required, and some components were missing (e.g. google-apis). Hope this helps anyone trying to use polymer with rails!