Class: Propshaft::Compilers::SourceMappingUrls

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

Constant Summary collapse

SOURCE_MAPPING_PATTERN =
%r{^(//|/\*)# sourceMappingURL=(.+\.map)}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(assembly) ⇒ SourceMappingUrls

Returns a new instance of SourceMappingUrls.



8
9
10
# File 'lib/propshaft/compilers/source_mapping_urls.rb', line 8

def initialize(assembly)
  @assembly = assembly
end

Instance Attribute Details

#assemblyObject (readonly)

Returns the value of attribute assembly.



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

def assembly
  @assembly
end

Instance Method Details

#compile(logical_path, input) ⇒ Object



12
13
14
# File 'lib/propshaft/compilers/source_mapping_urls.rb', line 12

def compile(logical_path, input)
  input.gsub(SOURCE_MAPPING_PATTERN) { source_mapping_url(asset_path($2, logical_path), $1) }
end