From 4a36f8742c0ff6ca3f8eafdc1c97a67a45d12227 Mon Sep 17 00:00:00 2001 From: balexand Date: Tue, 12 May 2015 16:40:33 -0600 Subject: Add woff2 mime type --- lib/rack/mime.rb | 1 + lib/rack/static.rb | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/rack/mime.rb b/lib/rack/mime.rb index 2879c05f..3208cc3f 100644 --- a/lib/rack/mime.rb +++ b/lib/rack/mime.rb @@ -614,6 +614,7 @@ module Rack ".wmx" => "video/x-ms-wmx", ".wmz" => "application/x-ms-wmz", ".woff" => "application/font-woff", + ".woff2" => "application/font-woff2", ".wpd" => "application/vnd.wordperfect", ".wpl" => "application/vnd.ms-wpl", ".wps" => "application/vnd.ms-works", diff --git a/lib/rack/static.rb b/lib/rack/static.rb index 75e1e555..074133d5 100644 --- a/lib/rack/static.rb +++ b/lib/rack/static.rb @@ -53,8 +53,8 @@ module Rack # 4) Regular Expressions / Regexp # Provide a regular expression # %r{\.(?:css|js)\z} => Matches files ending in .css or .js - # /\.(?:eot|ttf|otf|woff|svg)\z/ => Matches files ending in - # the most common web font formats (.eot, .ttf, .otf, .woff, .svg) + # /\.(?:eot|ttf|otf|woff2|woff|svg)\z/ => Matches files ending in + # the most common web font formats (.eot, .ttf, .otf, .woff2, .woff, .svg) # Note: This Regexp is available as a shortcut, using the :fonts rule # # 5) Font Shortcut @@ -132,7 +132,7 @@ module Rack when :all true when :fonts - path =~ /\.(?:ttf|otf|eot|woff|svg)\z/ + path =~ /\.(?:ttf|otf|eot|woff2|woff|svg)\z/ when String path = ::Rack::Utils.unescape(path) path.start_with?(rule) || path.start_with?('/' + rule) -- cgit v1.2.3-24-ge0c7