Method: Webpacker::Helper#stylesheet_pack_tag
- Defined in:
- lib/webpacker/helper.rb
#stylesheet_pack_tag(name, **options) ⇒ Object
Creates a link tag that references the named pack file, as compiled by Webpack per the entries list in config/webpack/shared.js. By default, this list is auto-generated to match everything in app/javascript/packs/*.js. In production mode, the digested reference is automatically looked up.
Examples:
# In development mode:
<%= stylesheet_pack_tag 'calendar', 'data-turbolinks-track': 'reload' %> # =>
<link rel="stylesheet" media="screen" href="/packs/calendar.css" data-turbolinks-track="reload" />
# In production mode:
<%= stylesheet_pack_tag 'calendar', 'data-turbolinks-track': 'reload' %> # =>
<link rel="stylesheet" media="screen" href="/packs/calendar-1016838bab065ae1e122.css" data-turbolinks-track="reload" />
44 45 46 |
# File 'lib/webpacker/helper.rb', line 44 def stylesheet_pack_tag(name, **) stylesheet_link_tag(Webpacker::Manifest.lookup("#{name}#{compute_asset_extname(name, type: :stylesheet)}"), **) end |