Sha256: c10453657cb548dcb0f58f900a265c0dd27218f997cb08c61ff208c1fc02141e
Contents?: true
Size: 1.07 KB
Versions: 2
Compression:
Stored size: 1.07 KB
Contents
# Frozen-string-literal: true # Copyright: 2012 - 2018 - MIT License # Encoding: utf-8 require "sprockets" module Jekyll module Assets module Map class CSS < Sprockets::SassCompressor def call(input) out = super(input) env = input[:environment] asset = env.find_asset!(input[:filename], pipeline: :source) path = asset.filename.sub(env.jekyll.in_source_dir + "/", "") url = Map.map_path(asset: asset, env: env) url = env.prefix_url(url) out.update({ data: <<~CSS #{out[:data].strip} /*# sourceMappingURL=#{url} */ /*# sourceURL=#{path} */ CSS }) end def self.register_on(instance) content_type = "text/css" instance.register_compressor content_type, :source_map, CSS end end # -- # We load late in some cases. # You can also register it in a Hook. # Globally Register it. # -- CSS.register_on(Sprockets) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jekyll-assets-3.0.7 | lib/jekyll/assets/map/css.rb |
jekyll-assets-3.0.6 | lib/jekyll/assets/map/css.rb |