From 475fa41de0e2743b4f5dfa555087d03aa96ff5a5 Mon Sep 17 00:00:00 2001 From: FearGoidte Date: Wed, 27 Jan 2016 09:48:36 +0000 Subject: [PATCH] Support for .xhtml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I’ve attempted to make support for .htm and .xhtml consistent. Extensions are in alphabetical order to make it easier to compare them. --- middleman-core/features/gzip.feature | 2 +- middleman-core/lib/middleman-core/application.rb | 2 +- middleman-core/lib/middleman-core/extensions/asset_hash.rb | 2 +- middleman-core/lib/middleman-core/extensions/asset_host.rb | 2 +- middleman-core/lib/middleman-core/extensions/cache_buster.rb | 2 +- middleman-core/lib/middleman-core/extensions/gzip.rb | 4 ++-- .../lib/middleman-core/extensions/relative_assets.rb | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/middleman-core/features/gzip.feature b/middleman-core/features/gzip.feature index 2f74cc9a..107b696d 100644 --- a/middleman-core/features/gzip.feature +++ b/middleman-core/features/gzip.feature @@ -22,7 +22,7 @@ Feature: GZIP assets during build Given a fixture app "gzip-app" And a file named "config.rb" with: """ - activate :gzip, exts: %w(.js .html .htm) + activate :gzip, exts: %w(.htm .html .js .xhtml .xml) """ And a successfully built app at "gzip-app" Then the following files should exist: diff --git a/middleman-core/lib/middleman-core/application.rb b/middleman-core/lib/middleman-core/application.rb index b0dbdb48..a7963f4f 100644 --- a/middleman-core/lib/middleman-core/application.rb +++ b/middleman-core/lib/middleman-core/application.rb @@ -154,7 +154,7 @@ module Middleman # Which file extensions have a layout by default. # @return [Array.] - define_setting :extensions_with_layout, %w(.html .xhtml .php), 'Which file extensions have a layout by default.' + define_setting :extensions_with_layout, %w(.htm .html .xhtml .php), 'Which file extensions have a layout by default.' # Default string encoding for templates and output. # @return [String] diff --git a/middleman-core/lib/middleman-core/extensions/asset_hash.rb b/middleman-core/lib/middleman-core/extensions/asset_hash.rb index ac464b69..c90d0223 100644 --- a/middleman-core/lib/middleman-core/extensions/asset_hash.rb +++ b/middleman-core/lib/middleman-core/extensions/asset_hash.rb @@ -2,7 +2,7 @@ require 'middleman-core/util' require 'middleman-core/rack' class Middleman::Extensions::AssetHash < ::Middleman::Extension - option :sources, %w(.htm .html .php .css .js), 'List of extensions that are searched for hashable assets.' + option :sources, %w(.css .htm .html .js .php .xhtml), 'List of extensions that are searched for hashable assets.' 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, [], 'Regexes of filenames to skip adding asset hashes to' option :rewrite_ignore, [], 'Regexes of filenames to skip processing for path rewrites' diff --git a/middleman-core/lib/middleman-core/extensions/asset_host.rb b/middleman-core/lib/middleman-core/extensions/asset_host.rb index 00d463fa..aa424e2f 100644 --- a/middleman-core/lib/middleman-core/extensions/asset_host.rb +++ b/middleman-core/lib/middleman-core/extensions/asset_host.rb @@ -3,7 +3,7 @@ require 'addressable/uri' class Middleman::Extensions::AssetHost < ::Middleman::Extension option :host, nil, 'The asset host to use or a Proc to determine asset host', required: true option :exts, %w(.css .png .jpg .jpeg .webp .svg .svgz .js .gif), 'List of extensions that get cache busters strings appended to them.' - option :sources, %w(.htm .html .php .css .js), 'List of extensions that are searched for bustable assets.' + option :sources, %w(.css .htm .html .js .php .xhtml), 'List of extensions that are searched for bustable assets.' option :ignore, [], 'Regexes of filenames to skip adding query strings to' option :rewrite_ignore, [], 'Regexes of filenames to skip processing for host rewrites' diff --git a/middleman-core/lib/middleman-core/extensions/cache_buster.rb b/middleman-core/lib/middleman-core/extensions/cache_buster.rb index 44eda9bc..958bd203 100644 --- a/middleman-core/lib/middleman-core/extensions/cache_buster.rb +++ b/middleman-core/lib/middleman-core/extensions/cache_buster.rb @@ -1,7 +1,7 @@ # The Cache Buster extension class Middleman::Extensions::CacheBuster < ::Middleman::Extension option :exts, %w(.css .png .jpg .jpeg .webp .svg .svgz .js .gif), 'List of extensions that get cache busters strings appended to them.' - option :sources, %w(.htm .html .php .css .js), 'List of extensions that are searched for bustable assets.' + option :sources, %w(.css .htm .html .js .php .xhtml), 'List of extensions that are searched for bustable assets.' option :ignore, [], 'Regexes of filenames to skip adding query strings to' option :rewrite_ignore, [], 'Regexes of filenames to skip processing for path rewrites' diff --git a/middleman-core/lib/middleman-core/extensions/gzip.rb b/middleman-core/lib/middleman-core/extensions/gzip.rb index 12079ab5..9ca9da0e 100644 --- a/middleman-core/lib/middleman-core/extensions/gzip.rb +++ b/middleman-core/lib/middleman-core/extensions/gzip.rb @@ -7,10 +7,10 @@ # to serve your Gzipped files whenever the normal (non-.gz) filename is requested. # # Pass the :exts options to customize which file extensions get zipped (defaults -# to .html, .htm, .js and .css. +# to .css, .htm, .html, .js, and .xhtml # class Middleman::Extensions::Gzip < ::Middleman::Extension - option :exts, %w(.js .css .html .htm .svg), 'File extensions to Gzip when building.' + option :exts, %w(.css .htm .html .js .svg .xhtml .xml), 'File extensions to Gzip when building.' option :ignore, [], 'Patterns to avoid gzipping' option :overwrite, false, 'Overwrite original files instead of adding .gz extension.' diff --git a/middleman-core/lib/middleman-core/extensions/relative_assets.rb b/middleman-core/lib/middleman-core/extensions/relative_assets.rb index a6d1f074..7fcb80d2 100644 --- a/middleman-core/lib/middleman-core/extensions/relative_assets.rb +++ b/middleman-core/lib/middleman-core/extensions/relative_assets.rb @@ -3,7 +3,7 @@ require 'addressable/uri' # Relative Assets extension class Middleman::Extensions::RelativeAssets < ::Middleman::Extension option :exts, %w(.css .png .jpg .jpeg .webp .svg .svgz .js .gif .ttf .otf .woff .woff2 .eot), 'List of extensions that get cache busters strings appended to them.' - option :sources, %w(.htm .html .css), 'List of extensions that are searched for relative assets.' + option :sources, %w(.css .htm .html .xhtml), 'List of extensions that are searched for relative assets.' option :ignore, [], 'Regexes of filenames to skip adding query strings to' option :rewrite_ignore, [], 'Regexes of filenames to skip processing for path rewrites'