0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Use Web Components with the Rails Asset Pipeline
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 4.2
 Project Readme

SilianRail

SilianRail extends Sprockets to allow you to import Web Components into the Rails Asset Pipeline.

Installation

Add the following line to your Rails application's Gemfile:

gem 'silian-rail'

Run the bundle command:

$ bundle

And generate a manifest file by running:

$ rails generate silian_rail:install

The generator will create a components folder and manifest file at app/assets/components/application.html.

Finally, insert the following tag into your application layout:

<%= html_include_tag 'application' %>

Usage

Use the Sprockets require Directive within the components manifest file to pull in a web component and its dependencies.

When referencing a web component (i.e. the Polymer paper-card component) you must reference the actual HTML file like so:

  *= require paper-card/paper-card

The require directive will search your assets paths (app/assets, lib/assets, and vendor/assets by default) for the directory and file. Once the directory/file is found, the component, along with any dependencies defined within, is pulled into the asset pipeline.

Contributing

  1. Fork it ( http://github.com/eanlain/silian-rail/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request