lib/sprockets/rails/asset_url_processor.rb in sprockets-rails-3.4.1 vs lib/sprockets/rails/asset_url_processor.rb in sprockets-rails-3.4.2
- old
+ new
@@ -1,9 +1,9 @@
module Sprockets
module Rails
- # Rewrites urls in CSS files with the digested paths
+ # Resolve assets referenced in CSS `url()` calls and replace them with the digested paths
class AssetUrlProcessor
- REGEX = /url\(\s*["']?(?!(?:\#|data|http))(?<relativeToCurrentDir>.\/)?(?<path>[^"'\s)]+)\s*["']?\)/
+ REGEX = /url\(\s*["']?(?!(?:\#|data|http))(?<relativeToCurrentDir>\.\/)?(?<path>[^"'\s)]+)\s*["']?\)/
def self.call(input)
context = input[:environment].context_class.new(input)
data = input[:data].gsub(REGEX) do |_match|
path = Regexp.last_match[:path]
"url(#{context.asset_path(path)})"