module Sprockets::Rails::Context

Public Class Methods

included(klass) click to toggle source
# File lib/sprockets/rails/context.rb, line 10
def self.included(klass)
  klass.class_eval do
    class_attribute :config, :assets_prefix, :digest_assets
  end
end

Public Instance Methods

compute_asset_path(path, options = {}) click to toggle source
Calls superclass method
# File lib/sprockets/rails/context.rb, line 16
def compute_asset_path(path, options = {})
  @dependencies << 'actioncontroller-asset-url-config'

  begin
    asset_uri = resolve(path)
  rescue FileNotFound
    # TODO: eh, we should be able to use a form of locate that returns
    # nil instead of raising an exception.
  end

  if asset_uri
    asset = link_asset(path)
    digest_path = asset.digest_path
    path = digest_path if digest_assets
    File.join(assets_prefix || "/", path)
  else
    super
  end
end