lib/csso/compressor.rb in csso-rails-0.8.1 vs lib/csso/compressor.rb in csso-rails-0.8.2

- old
+ new

@@ -2,19 +2,19 @@ class Compressor def self.call(input) require 'csso' #TODO: settings? if input[:metadata] && input[:metadata][:map] - css, map = Csso.optimize_with_sourcemap(input[:data], + css, map_json = Csso.optimize_with_sourcemap(input[:data], # Sprockets::PathUtils.split_subpath(input[:load_path], input[:filename]) # sprockets seems to ignore filenames here, so we may save some mem: 'uri' ) - map = Sprockets::SourceMapUtils.combine_source_maps( - input[:metadata][:map], - Sprockets::SourceMapUtils.decode_json_source_map(map)["mappings"] - ) - { data: css, map: map } + + { + data: css, + map: Sprockets::SourceMapUtils.combine_source_maps(input[:metadata][:map], JSON.parse(map_json)) + } else { data: Csso.optimize(input[:data], true) } end end