Class: Bridgetown::Tags::AssetPath
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- Bridgetown::Tags::AssetPath
- Defined in:
- lib/bridgetown-core/tags/asset_path.rb
Overview
A helper class to help find the path to assets inside of a webpack or esbuild manifest file.
Instance Method Summary collapse
- #initialize(tag_name, asset_type, options) ⇒ void constructor
-
#render(context) ⇒ String
Render an asset path based on the frontend manifest file.
Constructor Details
#initialize(tag_name, asset_type, options) ⇒ void
13 14 15 16 17 18 |
# File 'lib/bridgetown-core/tags/asset_path.rb', line 13 def initialize(tag_name, asset_type, ) super # js or css @asset_type = asset_type.strip end |
Instance Method Details
#render(context) ⇒ String
Render an asset path based on the frontend manifest file
27 28 29 30 31 |
# File 'lib/bridgetown-core/tags/asset_path.rb', line 27 def render(context) @context = context site = context.registers[:site] Bridgetown::Utils.parse_frontend_manifest_file(site, @asset_type) || "" end |