Class: Propshaft::Compilers::CssAssetUrls

Inherits:
Object
  • Object
show all
Defined in:
lib/propshaft/compilers/css_asset_urls.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(assembly) ⇒ CssAssetUrls

Returns a new instance of CssAssetUrls.



4
5
6
# File 'lib/propshaft/compilers/css_asset_urls.rb', line 4

def initialize(assembly)
  @assembly = assembly
end

Instance Attribute Details

#assemblyObject (readonly)

Returns the value of attribute assembly.



2
3
4
# File 'lib/propshaft/compilers/css_asset_urls.rb', line 2

def assembly
  @assembly
end

Instance Method Details

#compile(input) ⇒ Object



8
9
10
11
12
# File 'lib/propshaft/compilers/css_asset_urls.rb', line 8

def compile(input)
  input.gsub(/asset-path\(["']([^"')]+)["']\)/) do |match|
    %[url("#{assembly.config.prefix}/#{assembly.load_path.find($1).digested_path}")]
  end
end