Class: Nanoc3::Cachebuster::Css

Inherits:
Strategy
  • Object
show all
Defined in:
lib/nanoc3/cachebuster/strategy.rb

Overview

The Css strategy looks for CSS-style external references that use the url() syntax. This will typically cover any @import statements and references to images.

Constant Summary collapse

REGEX =
/
  url\(          # Start with the literal url(
  ('|"|)         # Then either a single, double or no quote at all
  (
    ([^'")]+)    # The file basename, and below the extension
    \.(#{Nanoc3::Cachebuster::FILETYPES_TO_FINGERPRINT.join('|')})
  )
  \1             # Repeat the same quote as at the start
  \)             # And cose the url()
/ix

Instance Attribute Summary

Attributes inherited from Strategy

#current_item, #site

Instance Method Summary collapse

Methods inherited from Strategy

for, inherited, #initialize

Constructor Details

This class inherits a constructor from Nanoc3::Cachebuster::Strategy

Instance Method Details

#apply(m, quote, filename, basename, extension) ⇒ Object



121
122
123
# File 'lib/nanoc3/cachebuster/strategy.rb', line 121

def apply(m, quote, filename, basename, extension)
  m.sub(filename, output_filename(filename))
end