Class: Assette::PostProcessor::CacheBuster

Inherits:
Object
  • Object
show all
Defined in:
lib/assette/post_processors/cache_buster.rb

Constant Summary collapse

URL_MATCHER =
/url\((?:["'])?(?!http)(?!\/\/)([\w\/\.\-\s\?=]+)(?:["'])?\)/i

Instance Method Summary collapse

Instance Method Details

#processorObject



9
10
11
12
13
14
15
16
17
# File 'lib/assette/post_processors/cache_buster.rb', line 9

def processor
  @@i ||= -1
  
  @str.gsub(URL_MATCHER) do |s|
    url = Assette.compiled_path @@i+=1, $1

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

#should_process?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/assette/post_processors/cache_buster.rb', line 5

def should_process?
  Assette.config.compiling?
end