Sha256: 136040c733386abecc5dcfabfd49a0e6082f067c8a9e80d1a15dc81f18859b92
Contents?: true
Size: 913 Bytes
Versions: 1
Compression:
Stored size: 913 Bytes
Contents
# frozen_string_literal: true module Sprockets class SourceMapCommentProcessor def self.call(input) case input[:content_type] when "application/javascript" comment = "\n//# sourceMappingURL=%s" map_type = "application/js-sourcemap+json" when "text/css" comment = "\n/*# sourceMappingURL=%s */" map_type = "application/css-sourcemap+json" else fail input[:content_type] end env = input[:environment] uri, _ = env.resolve!(input[:filename], accept: input[:content_type]) asset = env.load(uri) uri, _ = env.resolve!(input[:filename], accept: map_type) map = env.load(uri) path = PathUtils.relative_path_from(input[:filename], map.full_digest_path) asset.metadata.merge( data: asset.source + (comment % path), links: asset.links + [asset.uri, map.uri] ) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sprockets-4.0.0.beta4 | lib/sprockets/source_map_comment_processor.rb |