Class: Propshaft::Compiler::SourceMappingUrls

Inherits:
Propshaft::Compiler show all
Defined in:
lib/propshaft/compiler/source_mapping_urls.rb

Constant Summary collapse

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

Instance Attribute Summary

Attributes inherited from Propshaft::Compiler

#assembly

Instance Method Summary collapse

Methods inherited from Propshaft::Compiler

#initialize, #referenced_by

Constructor Details

This class inherits a constructor from Propshaft::Compiler

Instance Method Details

#compile(asset, input) ⇒ Object



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

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