Sha256: 5e92fe88e5a8bc76406fc82cc1794cb8f9be310b78a090e8e502be9e6782bcf8
Contents?: true
Size: 987 Bytes
Versions: 2
Compression:
Stored size: 987 Bytes
Contents
# frozen_string_literal: true require 'sprockets/autoload' require 'sprockets/sass_compressor' require 'base64' module Sprockets class SasscCompressor < SassCompressor def initialize(options = {}) @options = { syntax: :scss, style: :compressed, source_map_embed: true, source_map_file: '.' }.merge(options).freeze end def call(input) # SassC requires the template to be modifiable input_data = input[:data].frozen? ? input[:data].dup : input[:data] data = Autoload::SassC::Engine.new(input_data, @options.merge(filename: 'filename')).render match_data = data.match(/(.*)\n\/\*# sourceMappingURL=data:application\/json;base64,(.+) \*\//m) css, map = match_data[1], Base64.decode64(match_data[2]) map = SourceMapUtils.combine_source_maps( input[:metadata][:map], SourceMapUtils.decode_json_source_map(map)["mappings"] ) { data: css, map: map } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sprockets-4.0.0.beta4 | lib/sprockets/sassc_compressor.rb |
sprockets-4.0.0.beta3 | lib/sprockets/sassc_compressor.rb |