fix #1496 : Asset hashes on WOFF vs WOFF2 fonts get confused
reverse sorting the extensions regex solves this issue
This commit is contained in:
parent
3b88496803
commit
d7d37e4ae0
5 changed files with 14 additions and 1 deletions
|
@ -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 "/"
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,4 @@
|
|||
@font-face {
|
||||
font-family: 'FontAwesome';
|
||||
src: url('../fonts/fontawesome-webfont.woff2') format('woff2'), url('../fonts/fontawesome-webfont.woff') format('woff');
|
||||
}
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue