Merge pull request #1533 from akarzim/fix/asset_hash

fix #1496 : Asset hashes on WOFF vs WOFF2 fonts get confused
v3-stable
Thomas Reynolds 2015-05-28 09:56:48 -07:00
commit 7eedf6b28f
5 changed files with 14 additions and 1 deletions

View File

@ -47,6 +47,15 @@ Feature: Assets get a file hash appended to their and references to them are upd
And the file "subdir/api.json" should contain 'images/100px-5fd6fb90.jpg'
And the file "subdir/api.json" should contain 'images/100px-1242c368.png'
Scenario: Hashed fonts assets work with woff and woff2 extension
Given a successfully built app at "asset-hash-app"
When I cd to "build"
Then the following files should exist:
| fonts/fontawesome-webfont-56ce13e7.woff |
| fonts/fontawesome-webfont-10752316.woff2 |
And the file "stylesheets/uses_fonts-88aa3e2b.css" should contain "src: url('../fonts/fontawesome-webfont-10752316.woff2')"
And the file "stylesheets/uses_fonts-88aa3e2b.css" should contain "url('../fonts/fontawesome-webfont-56ce13e7.woff')"
Scenario: Hashed assets work in preview server
Given the Server is running at "asset-hash-app"
When I go to "/"

View File

@ -0,0 +1,4 @@
@font-face {
font-family: 'FontAwesome';
src: url('../fonts/fontawesome-webfont.woff2') format('woff2'), url('../fonts/fontawesome-webfont.woff') format('woff');
}

View File

@ -63,7 +63,7 @@ class Middleman::Extensions::AssetHash < ::Middleman::Extension
@rack_app = app
@exts = options[:exts]
@ignore = options[:ignore]
@exts_regex_text = @exts.map { |e| Regexp.escape(e) }.join('|')
@exts_regex_text = @exts.map { |e| Regexp.escape(e) }.sort.reverse.join('|')
@middleman_app = options[:middleman_app]
end