class Sprockets::Context
def resolve_with_compat(path, options = {})
# => "file:///path/to/app/javascripts/foo.js?type=application/javascript"
resolve("foo.js")
4.x
# => "file:///path/to/app/javascripts/foo.js?type=application/javascript"
resolve("foo.js", compat: false)
# => "/path/to/app/javascripts/foo.js"
resolve("foo.js", compat: true)
# => "/path/to/app/javascripts/foo.js"
resolve("foo.js")
3.x
# => "/path/to/app/javascripts/foo.js"
resolve("foo.js")
2.x
compatible plain filename String. 4.x will always return an Asset URI.
Deprecated: Change default return type of resolve() to return 2.x
def resolve_with_compat(path, options = {}) options = options.dup # Support old :content_type option, prefer :accept going forward if type = options.delete(:content_type) type = self.content_type if type == :self options[:accept] ||= type end if options.delete(:compat) { true } uri = resolve_without_compat(path, options) path, _ = environment.parse_asset_uri(uri) path else resolve_without_compat(path, options) end end