Class: Nanoc3::Cachebuster::Html
- Defined in:
- lib/nanoc3/cachebuster/strategy.rb
Overview
The Html strategy looks for HTML-style attributes in the item source code, picking up the values of href and src attributes. This will typically cover links, stylesheets, images and javascripts.
Constant Summary collapse
- REGEX =
/ (href|src) # Look for either an href="" or src="" attribute = # ...followed by an = ("|'|) # Then either a single, double or no quote at all ( # Capture the entire reference [^'"]+ # Anything but something that would close the attribute # And then the extension: (\.(?:#{Nanoc3::Cachebuster::FILETYPES_TO_FINGERPRINT.join('|')})) ) \2 # Repeat the opening quote /ix
Instance Attribute Summary
Attributes inherited from Strategy
Instance Method Summary collapse
Methods inherited from Strategy
Constructor Details
This class inherits a constructor from Nanoc3::Cachebuster::Strategy
Instance Method Details
#apply(m, attribute, quote, filename, extension) ⇒ Object
142 143 144 |
# File 'lib/nanoc3/cachebuster/strategy.rb', line 142 def apply(m, attribute, quote, filename, extension) %Q{#{attribute}=#{quote}#{output_filename(filename)}#{quote}} end |