Method: Sprockets::Resolve#resolve!

Defined in:
lib/sprockets/resolve.rb

#resolve!(path, options = {}) ⇒ Object

Public: Same as resolve() but raises a FileNotFound exception instead of nil if no assets are found.



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/sprockets/resolve.rb', line 51

def resolve!(path, options = {})
  uri, deps = resolve(path, options.merge(compat: false))

  unless uri
    message = "couldn't find file '#{path}'"

    if relative_path?(path) && options[:base_path]
      load_path, _ = paths_split(config[:paths], options[:base_path])
      message << " under '#{load_path}'"
    end

    message << " with type '#{options[:accept]}'" if options[:accept]

    raise FileNotFound, message
  end

  return uri, deps
end