class Sprockets::Preprocessors::DefaultSourceMap
available.
Because other generators run after might depend on having a valid source map
result. Otherwise it maps 1 for 1 lines original to generated. This is needed
If the input file already has a source map, it effectively returns the original
Private: Adds a default map to assets when one is not present
def call(input)
def call(input) result = { data: input[:data] } map = input[:metadata][:map] if map.nil? || map.empty? result[:map] ||= [] input[:data].each_line.with_index do |_, index| line = index + 1 result[:map] << { source: input[:source_path], generated: [line , 0], original: [line, 0] } end end return result end