Sha256: df6e31c8d7888ac053b533ef68d0438b3ab3f6178108ee0588d091b3cc24af10

Contents?: true

Size: 428 Bytes

Versions: 5

Compression:

Stored size: 428 Bytes

Contents

class Assette::PostProcessor::CacheBuster < Assette::PostProcessor(:css)
  URL_MATCHER = /url\((?:["'])?(?!http)(?!\/\/)([\w\/\.\-\s\?=]+)(?:["'])?\)/i
  
  def should_process?
    Assette.config.compiling?
  end
  
  def processor
    @@i ||= -1
    
    @str.gsub(URL_MATCHER) do |s|
      url = File.join(Assette.config.asset_host(@@i+=1),Assette.config.compiled_path($1))
      
      %Q{url("#{url}")}
    end
  end
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
assette-0.0.5 lib/assette/post_processors/cache_buster.rb
assette-0.0.4 lib/assette/post_processors/cache_buster.rb
assette-0.0.3 lib/assette/post_processors/cache_buster.rb
assette-0.0.2 lib/assette/post_processors/cache_buster.rb
assette-0.0.1 lib/assette/post_processors/cache_buster.rb