Merge pull request #1472 from schurig/assets_pipeline_hash_for_woff2

Append assets hash also to .woff2 files
This commit is contained in:
Thomas Reynolds 2015-02-25 14:20:43 -08:00
commit ef835862bc
3 changed files with 6 additions and 4 deletions

View file

@ -178,7 +178,7 @@ module Middleman::Cli
# @return [void]
def execute!
# Sort order, images, fonts, js/css and finally everything else.
sort_order = %w(.png .jpeg .jpg .gif .bmp .svg .svgz .ico .webp .woff .otf .ttf .eot .js .css)
sort_order = %w(.png .jpeg .jpg .gif .bmp .svg .svgz .ico .webp .woff .woff2 .otf .ttf .eot .js .css)
# Pre-request CSS to give Compass a chance to build sprites
logger.debug '== Prerendering CSS'

View file

@ -21,7 +21,7 @@
<IfModule mod_headers.c>
Header set X-UA-Compatible "IE=Edge,chrome=1"
# mod_headers can't match by content-type, but we don't want to send this header on *everything*...
<FilesMatch "\.(js|css|gif|png|jpe?g|pdf|xml|oga|ogg|m4a|ogv|mp4|m4v|webm|svg|svgz|eot|ttf|otf|woff|ico|webp|appcache|manifest|htc|crx|oex|xpi|safariextz|vcf)$" >
<FilesMatch "\.(js|css|gif|png|jpe?g|pdf|xml|oga|ogg|m4a|ogv|mp4|m4v|webm|svg|svgz|eot|ttf|otf|woff|woff2|ico|webp|appcache|manifest|htc|crx|oex|xpi|safariextz|vcf)$" >
Header unset X-UA-Compatible
</FilesMatch>
</IfModule>
@ -70,7 +70,7 @@
# subdomains like "subdomain.example.com".
<IfModule mod_headers.c>
<FilesMatch "\.(ttf|ttc|otf|eot|woff|font.css)$">
<FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|font.css)$">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>
</IfModule>
@ -107,6 +107,7 @@ AddType application/vnd.ms-fontobject eot
AddType application/x-font-ttf ttf ttc
AddType font/opentype otf
AddType application/x-font-woff woff
AddType application/font-woff2 woff2
# Assorted types
AddType image/x-icon ico
@ -238,6 +239,7 @@ AddType text/vtt vtt
ExpiresByType application/x-font-ttf "access plus 1 month"
ExpiresByType font/opentype "access plus 1 month"
ExpiresByType application/x-font-woff "access plus 1 month"
ExpiresByType application/font-woff2 "access plus 1 month"
ExpiresByType image/svg+xml "access plus 1 month"
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"

View file

@ -1,7 +1,7 @@
require 'middleman-core/util'
class Middleman::Extensions::AssetHash < ::Middleman::Extension
option :exts, %w(.jpg .jpeg .png .gif .webp .js .css .otf .woff .eot .ttf .svg .svgz), 'List of extensions that get asset hashes appended to them.'
option :exts, %w(.jpg .jpeg .png .gif .webp .js .css .otf .woff .woff2 .eot .ttf .svg .svgz), 'List of extensions that get asset hashes appended to them.'
option :ignore, [], 'Patterns to avoid adding asset hashes to'
def initialize(app, options_hash={}, &block)