Method: Webpacker::Helper#stylesheet_packs_with_chunks_tag

Defined in:
lib/webpacker/helper.rb

#stylesheet_packs_with_chunks_tag(*names, **options) ⇒ Object

Creates link tags that reference the css chunks from entrypoints when using split chunks API, as compiled by webpack per the entries list in package/environments/base.js. By default, this list is auto-generated to match everything in app/javascript/packs/*.js and all the dependent chunks. In production mode, the digested reference is automatically looked up. See: webpack.js.org/plugins/split-chunks-plugin/

Examples:

<%= stylesheet_packs_with_chunks_tag 'calendar', 'map' %> # =>
<link rel="stylesheet" media="screen" href="/packs/3-8c7ce31a.chunk.css" />
<link rel="stylesheet" media="screen" href="/packs/calendar-8c7ce31a.chunk.css" />
<link rel="stylesheet" media="screen" href="/packs/map-8c7ce31a.chunk.css" />

DO:

<%= stylesheet_packs_with_chunks_tag 'calendar', 'map' %>

DON’T:

<%= stylesheet_packs_with_chunks_tag 'calendar' %>
<%= stylesheet_packs_with_chunks_tag 'map' %>


170
171
172
173
174
# File 'lib/webpacker/helper.rb', line 170

def stylesheet_packs_with_chunks_tag(*names, **options)
  if current_webpacker_instance.config.extract_css?
    stylesheet_link_tag(*sources_from_manifest_entrypoints(names, type: :stylesheet), **options)
  end
end