diff --git a/middleman-core/features/asset_hash.feature b/middleman-core/features/asset_hash.feature index dd659336..6a353370 100644 --- a/middleman-core/features/asset_hash.feature +++ b/middleman-core/features/asset_hash.feature @@ -283,8 +283,15 @@ Feature: Assets get file hashes appended to them and references to them are upda When I cd to "build" Then the following files should exist: | javascripts/jquery.min-276c87ff.js | + | stylesheets/test-7de2ad06.css | And the following files should not exist: | javascripts/jquery.min.js | + And the file "stylesheets/test-7de2ad06.css" should contain: + """ + .no-bug{background-image:url(/images/100px-5fd6fb90.jpg)} + .bug{content:"";background-image:url(/images/100px-5fd6fb90.jpg)} + .no-bug{content:""; background-image:url(/images/100px-5fd6fb90.jpg)} + """ Scenario: Source map paths include the hash Given a successfully built app at "asset-hash-source-map" diff --git a/middleman-core/fixtures/asset-hash-minified-app/source/images/100px.jpg b/middleman-core/fixtures/asset-hash-minified-app/source/images/100px.jpg new file mode 100644 index 00000000..557d0278 Binary files /dev/null and b/middleman-core/fixtures/asset-hash-minified-app/source/images/100px.jpg differ diff --git a/middleman-core/fixtures/asset-hash-minified-app/source/stylesheets/test.css b/middleman-core/fixtures/asset-hash-minified-app/source/stylesheets/test.css new file mode 100644 index 00000000..059fce9a --- /dev/null +++ b/middleman-core/fixtures/asset-hash-minified-app/source/stylesheets/test.css @@ -0,0 +1,3 @@ +.no-bug{background-image:url(/images/100px.jpg)} +.bug{content:"";background-image:url(/images/100px.jpg)} +.no-bug{content:""; background-image:url(/images/100px.jpg)} diff --git a/middleman-core/lib/middleman-core/util/rack.rb b/middleman-core/lib/middleman-core/util/rack.rb index 17ac7252..f8003efe 100644 --- a/middleman-core/lib/middleman-core/util/rack.rb +++ b/middleman-core/lib/middleman-core/util/rack.rb @@ -22,7 +22,7 @@ module Middleman Contract String, String, ArrayOf[String], Proc => String def rewrite_paths(body, _path, exts, &_block) - matcher = /([\'\"\(,]\s*|# sourceMappingURL=)([^\s\'\"\)>]+(#{::Regexp.union(exts)}))/ + matcher = /([\'\"\(,]\s*|# sourceMappingURL=)([^\s\'\"\)\(>]+(#{::Regexp.union(exts)}))/ url_fn_prefix = 'url('