module Webpacker::Helper
def asset_pack_url(name, **options)
# When extract_css is true in webpacker.yml or the file is not a css:
<%= asset_pack_url 'calendar.css' %> # => nil
# When extract_css is false in webpacker.yml and the file is a css:
Example:
This will use asset_url internally, so most of their behaviors will be the same.
Return absolute path using manifest.json and passes it to asset_url helper.
Computes the absolute path for a given Webpacker asset.
def asset_pack_url(name, **options) if current_webpacker_instance.config.extract_css? || !stylesheet?(name) asset_url(current_webpacker_instance.manifest.lookup!(name), **options) end end