Module: ExternalAssetPipeline::Helper
- Defined in:
- lib/external_asset_pipeline/helper.rb
Instance Method Summary collapse
-
#compute_asset_path(source, options = {}) ⇒ Object
Overrides the built-in ‘ActionView::Helpers::AssetUrlHelper#compute_asset_path` to use the external asset pipeline, in the same manner that sprockets-rails does: github.com/rails/sprockets-rails/blob/v3.2.1/lib/sprockets/rails/helper.rb#L74-L96.
-
#external_asset_pipeline_manifest ⇒ Object
This helper method can be overridden to return a different Manifest instance, e.g.
Instance Method Details
#compute_asset_path(source, options = {}) ⇒ Object
Overrides the built-in ‘ActionView::Helpers::AssetUrlHelper#compute_asset_path` to use the external asset pipeline, in the same manner that sprockets-rails does: github.com/rails/sprockets-rails/blob/v3.2.1/lib/sprockets/rails/helper.rb#L74-L96
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/external_asset_pipeline/helper.rb', line 17 def compute_asset_path(source, = {}) manifest = external_asset_pipeline_manifest asset = manifest.find(source) [:host] = asset[:host] if asset && asset[:host] return asset[:path] if asset return super if manifest.fall_back_to_sprockets? raise AssetNotFound, "The asset #{source.inspect} is not present in the asset manifest" end |
#external_asset_pipeline_manifest ⇒ Object
This helper method can be overridden to return a different Manifest instance, e.g. to have distinct instances in different rails engines.
9 10 11 |
# File 'lib/external_asset_pipeline/helper.rb', line 9 def external_asset_pipeline_manifest ExternalAssetPipeline.manifest end |