diff --git a/CHANGELOG.md b/CHANGELOG.md index a7607c8e0..3881b9269 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ Get upgrade notes from Sprockets 3.x to 4.x at https://github.com/rails/sprockets/blob/master/UPGRADING.md - Fix for precompile issues when multiple extensions map to the same MIME type (eg. `.jpeg` / `.jpg`). [#781](https://github.com/rails/sprockets/pull/781) +- Fix `application/css-sourcemap+json` charset [#764](https://github.com/rails/sprockets/pull/764) - Fix compatibility with Rack 2 applications. [#790](https://github.com/rails/sprockets/pull/790) ## 4.2.0 @@ -13,6 +14,10 @@ Get upgrade notes from Sprockets 3.x to 4.x at https://github.com/rails/sprocket - Make `Sprockets::Utils.module_include` thread safe on JRuby. [#759](https://github.com/rails/sprockets/pull/759) - Fix typo in `asset.rb` file. [#768](https://github.com/rails/sprockets/pull/768) +## 4.1.1 + +- Fix `Sprockets::Server` to return response headers to be compatible with Rack::Lint 2.0. + ## 4.1.0 - Allow age to be altered in asset:clean rake task. diff --git a/lib/sprockets.rb b/lib/sprockets.rb index fb03df54a..c74f1d71d 100644 --- a/lib/sprockets.rb +++ b/lib/sprockets.rb @@ -91,7 +91,7 @@ module Sprockets require 'sprockets/source_map_processor' register_mime_type 'application/js-sourcemap+json', extensions: ['.js.map'], charset: :unicode - register_mime_type 'application/css-sourcemap+json', extensions: ['.css.map'] + register_mime_type 'application/css-sourcemap+json', extensions: ['.css.map'], charset: :unicode register_transformer 'application/javascript', 'application/js-sourcemap+json', SourceMapProcessor register_transformer 'text/css', 'application/css-sourcemap+json', SourceMapProcessor diff --git a/test/test_source_maps.rb b/test/test_source_maps.rb index 7be43f077..f71f30d87 100644 --- a/test/test_source_maps.rb +++ b/test/test_source_maps.rb @@ -60,7 +60,7 @@ def get_sources(map) ], get_sources(map) end - test "reads the data transcoded to UTF-8" do + test "reads js data transcoded to UTF-8" do processor = Proc.new do |input| assert_equal Encoding::UTF_8, input[:data].encoding { data: input[:data] } @@ -71,6 +71,17 @@ def get_sources(map) @env.unregister_preprocessor('application/javascript', processor) end + test "reads css data transcoded to UTF-8" do + processor = Proc.new do |input| + assert_equal Encoding::UTF_8, input[:data].encoding + { data: input[:data] } + end + @env.register_processor('text/css', processor) + assert asset = @env.find_asset('sass/precompiled/main.css', pipeline: :debug) + ensure + @env.unregister_preprocessor('text/css', processor) + end + test "builds a minified source map" do @env.js_compressor = Sprockets::UglifierCompressor.new