Class: Propshaft::Compilers::CssAssetUrls
- Inherits:
-
Object
- Object
- Propshaft::Compilers::CssAssetUrls
- Defined in:
- lib/propshaft/compilers/css_asset_urls.rb
Constant Summary collapse
- ASSET_URL_PATTERN =
/url\(\s*["']?(?!(?:\#|data|http))([^"'\s)]+)\s*["']?\)/
Instance Attribute Summary collapse
-
#assembly ⇒ Object
readonly
Returns the value of attribute assembly.
Instance Method Summary collapse
- #compile(logical_path, input) ⇒ Object
-
#initialize(assembly) ⇒ CssAssetUrls
constructor
A new instance of CssAssetUrls.
Constructor Details
#initialize(assembly) ⇒ CssAssetUrls
Returns a new instance of CssAssetUrls.
9 10 11 |
# File 'lib/propshaft/compilers/css_asset_urls.rb', line 9 def initialize(assembly) @assembly = assembly end |
Instance Attribute Details
#assembly ⇒ Object (readonly)
Returns the value of attribute assembly.
5 6 7 |
# File 'lib/propshaft/compilers/css_asset_urls.rb', line 5 def assembly @assembly end |
Instance Method Details
#compile(logical_path, input) ⇒ Object
13 14 15 |
# File 'lib/propshaft/compilers/css_asset_urls.rb', line 13 def compile(logical_path, input) input.gsub(ASSET_URL_PATTERN) { asset_url resolve_path(logical_path.dirname, $1) } end |