Using multiple layouts with Rails assets pipeline
If we want to use the stylesheet widget.css
from a specific layout (not the layouts/application.html.erb
one) we can include it using in our layout (layouts/widget.html.erb
in my example):
<%= stylesheet_link_tag "widget", media: "all", "data-turbolinks-track" => true %>
The, we need to include this line in the application.rb
file to add the asset to the pipeline:
config.assets.precompile += %w(widget.css)
Written by Pablo Torrecilla
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Rails
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#