Method: Webpacker::Helper#javascript_pack_tag

Defined in:
lib/webpacker/helper.rb

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

Creates a script 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.

Example:

<%= javascript_pack_tag 'calendar', 'data-turbolinks-track': 'reload' %> # =>
<script src="/packs/calendar-1016838bab065ae1e314.js" data-turbolinks-track="reload"></script>

54
55
56
# File 'lib/webpacker/helper.rb', line 54

def javascript_pack_tag(*names, **options)
  javascript_include_tag(*sources_from_pack_manifest(names, type: :javascript), **options)
end