Module: Sprockets::Rails::Helper

Includes:
ActiveSupport::Configurable
Defined in:
lib/sprockets_better_errors/sprockets_rails_helper.rb

Defined Under Namespace

Classes: AssetFilteredError, AssetNotPresentError, DependencyError

Instance Method Summary collapse

Instance Method Details

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



51
52
53
54
# File 'lib/sprockets_better_errors/sprockets_rails_helper.rb', line 51

def asset_path(source, options = {})
  check_errors_for(source)
  path_to_asset(source, options)
end

#check_dependencies!(dep) ⇒ Object

Raises:



13
14
15
16
17
# File 'lib/sprockets_better_errors/sprockets_rails_helper.rb', line 13

def check_dependencies!(dep)
  return unless @_dependency_assets
  return if     @_dependency_assets.detect { |asset| asset.include?(dep) }
  raise DependencyError.new(self.pathname, dep)
end

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



20
21
22
23
# File 'lib/sprockets_better_errors/sprockets_rails_helper.rb', line 20

def compute_asset_path(path, options = {})
  check_dependencies!(path)
  orig_compute_asset_path(path, options)
end

#javascript_include_tag(*args) ⇒ Object



57
58
59
60
61
62
63
64
# File 'lib/sprockets_better_errors/sprockets_rails_helper.rb', line 57

def javascript_include_tag(*args)
  sources = args.dup
  sources.extract_options!
  sources.map do |source|
    check_errors_for(source)
  end
  orig_javascript_include_tag(*args)
end

#orig_asset_pathObject



50
# File 'lib/sprockets_better_errors/sprockets_rails_helper.rb', line 50

alias :orig_asset_path :asset_path

#orig_compute_asset_pathObject



19
# File 'lib/sprockets_better_errors/sprockets_rails_helper.rb', line 19

alias :orig_compute_asset_path :compute_asset_path

#orig_javascript_include_tagObject



56
# File 'lib/sprockets_better_errors/sprockets_rails_helper.rb', line 56

alias :orig_javascript_include_tag :javascript_include_tag


66
# File 'lib/sprockets_better_errors/sprockets_rails_helper.rb', line 66

alias :orig_stylesheet_link_tag :stylesheet_link_tag


67
68
69
70
71
72
73
74
# File 'lib/sprockets_better_errors/sprockets_rails_helper.rb', line 67

def stylesheet_link_tag(*args)
  sources = args.dup
  sources.extract_options!
  sources.map do |source|
    check_errors_for(source)
  end
  orig_stylesheet_link_tag(*args)
end