summary refs log tree commit
diff options
context:
space:
mode:
authorbalexand <balexand@gmail.com>2015-05-12 16:40:33 -0600
committerbalexand <balexand@gmail.com>2015-05-12 16:40:33 -0600
commit4a36f8742c0ff6ca3f8eafdc1c97a67a45d12227 (patch)
tree9ca666d2dc90be008bcd31eff9d64d59d602b13c
parent08e62f29164505e50f3b3acc09e4c67a843e0172 (diff)
downloadrack-4a36f8742c0ff6ca3f8eafdc1c97a67a45d12227.tar.gz
Add woff2 mime type
-rw-r--r--lib/rack/mime.rb1
-rw-r--r--lib/rack/static.rb6
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)