Merge pull request #1853 from adam-h/asset-hash-1852

Fix asset_hash with content rule and uncommented CSS url
feature/manifest
Thomas Reynolds 2016-03-22 10:09:53 -07:00
commit 9d29cd58de
4 changed files with 11 additions and 1 deletions

View File

@ -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"

Binary file not shown.

After

Width:  |  Height:  |  Size: 334 B

View File

@ -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)}

View File

@ -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('