Class: Nanoc::Filters::CacheBuster

Inherits:
Nanoc::Filter
  • Object
show all
Defined in:
lib/nanoc/filters/cache_buster.rb

Instance Method Summary collapse

Instance Method Details

#run(content, options = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/nanoc/filters/cache_buster.rb', line 6

def run(content, options = {})
  kind = options[:strategy] || (stylesheet? ? :css : :html)
  strategy = Nanoc::Cachebuster::Strategy.for(kind , site, item)
  content.gsub(strategy.class::REGEX) do |m|
    begin
      strategy.apply m, $1, $2, $3, $4
    rescue Nanoc::Cachebuster::NoSuchSourceFile
      m
    end
  end
end