Module: RailsExternalAssetPipeline::ComputeAssetPath

Defined in:
lib/rails_external_asset_pipeline/compute_asset_path.rb

Constant Summary collapse

TYPES_WITH_MANIFEST =
%i(stylesheet image javascript)

Instance Method Summary collapse

Instance Method Details

#compute_asset_path(source, options = {}) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/rails_external_asset_pipeline/compute_asset_path.rb', line 7

def compute_asset_path(source, options = {})
  if TYPES_WITH_MANIFEST.include? options[:type]
    manifest = Manifest.new(manifests_path, options[:type])
    manifest.fetch(source)
  else
    source
  end
end

#manifests_pathObject



16
17
18
19
# File 'lib/rails_external_asset_pipeline/compute_asset_path.rb', line 16

def manifests_path
  Rails.configuration.x.rails_external_asset_pipeline.manifests_path ||
    File.join("public", "assets", "manifests")
end