Module: WebpackManifest::Rails::Helper
- Defined in:
- lib/webpack_manifest/rails/helper.rb
Instance Method Summary collapse
-
#asset_bundle_path(name, manifest: nil, **options) ⇒ Object
Example:.
-
#image_bundle_tag(name, manifest: nil, **options) ⇒ Object
Examples:.
-
#javascript_bundle_tag(*names, manifest: nil, **options) ⇒ Object
Example:.
-
#stylesheet_bundle_tag(*names, manifest: nil, **options) ⇒ Object
Examples:.
Instance Method Details
#asset_bundle_path(name, manifest: nil, **options) ⇒ Object
Example:
<%= asset_bundle_path 'calendar.css' %> # => "/assets/web/pack/calendar-1016838bab065ae1e122.css"
<%= asset_bundle_path 'icon/favicon.ico' %> # => "/assets/web/pack/icon/favicon-1016838bab065ae1e122.ico"
10 11 12 13 |
# File 'lib/webpack_manifest/rails/helper.rb', line 10 def asset_bundle_path(name, manifest: nil, **) manifest = get_manifest_by_key(manifest) asset_path(manifest.lookup!(name.to_s), **) end |
#image_bundle_tag(name, manifest: nil, **options) ⇒ Object
Examples:
<%= image_bundle_tag 'icon.png'
<img src="/assets/pack/icon-1016838bab065ae1e314.png" />
<%= image_bundle_tag "icon.png", size: "16x10", alt: "Edit Entry"
<img src="/assets/pack/icon-1016838bab065ae1e314.png" width="16" height="10" alt="Edit Entry" />
46 47 48 49 |
# File 'lib/webpack_manifest/rails/helper.rb', line 46 def image_bundle_tag(name, manifest: nil, **) manifest = get_manifest_by_key(manifest) image_tag(manifest.lookup!(name.to_s), **) end |
#javascript_bundle_tag(*names, manifest: nil, **options) ⇒ Object
Example:
<%= javascript_bundle_tag 'calendar', 'data-turbolinks-track': 'reload' %> # =>
<script src="/assets/web/pack/calendar-1016838bab065ae1e314.js" data-turbolinks-track="reload"></script>
<%= javascript_bundle_tag 'orders/app' %> # =>
<script src="/assets/web/pack/orders/app-1016838bab065ae1e314.js"></script>
22 23 24 |
# File 'lib/webpack_manifest/rails/helper.rb', line 22 def javascript_bundle_tag(*names, manifest: nil, **) javascript_include_tag(*sources_from_manifest(names, 'js', key: manifest), **) end |
#stylesheet_bundle_tag(*names, manifest: nil, **options) ⇒ Object
Examples:
<%= stylesheet_bundle_tag 'calendar', 'data-turbolinks-track': 'reload' %> # =>
<link rel="stylesheet" media="screen"
href="/assets/web/pack/calendar-1016838bab065ae1e122.css" data-turbolinks-track="reload" />
<%= stylesheet_bundle_tag 'orders/style' %> # =>
<link rel="stylesheet" media="screen"
href="/assets/web/pack/orders/style-1016838bab065ae1e122.css" />
35 36 37 |
# File 'lib/webpack_manifest/rails/helper.rb', line 35 def stylesheet_bundle_tag(*names, manifest: nil, **) stylesheet_link_tag(*sources_from_manifest(names, 'css', key: manifest), **) end |