Sha256: 30630c6bebeae45abee2b8d9fb4b88f31f12d0b746b3ad794fa6f6735ec998d7

Contents?: true

Size: 415 Bytes

Versions: 4

Compression:

Stored size: 415 Bytes

Contents

module Assette
  class 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 = Assette.compiled_path @@i+=1, $1

        %Q{url("#{url}")}
      end
    end
  
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
assette-0.1.8 lib/assette/post_processors/cache_buster.rb
assette-0.1.7 lib/assette/post_processors/cache_buster.rb
assette-0.1.6 lib/assette/post_processors/cache_buster.rb
assette-0.1.5 lib/assette/post_processors/cache_buster.rb