From 17e3735d44d72b33a1d67549f53ce6d89d80b1fb Mon Sep 17 00:00:00 2001 From: Ben Hollis Date: Wed, 30 Nov 2011 20:04:23 -0800 Subject: [PATCH] A slight speedup in the sitemap extension by only scanning the source directory. This way sitemap will not scan through all the files in your project (including .git files and such) when it doesn't ever need to know about those files. This also includes a slight tightening of the regex for filtering paths for front_matter. --- lib/middleman/core_extensions/front_matter.rb | 2 +- lib/middleman/core_extensions/sitemap.rb | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/middleman/core_extensions/front_matter.rb b/lib/middleman/core_extensions/front_matter.rb index 4523b504..416f686d 100644 --- a/lib/middleman/core_extensions/front_matter.rb +++ b/lib/middleman/core_extensions/front_matter.rb @@ -52,7 +52,7 @@ module Middleman::CoreExtensions::FrontMatter class FrontMatter class << self def matcher - %r{source/.*\.html} + %r{^source/.*\.html} end end diff --git a/lib/middleman/core_extensions/sitemap.rb b/lib/middleman/core_extensions/sitemap.rb index b58cc922..2fd1dfd6 100644 --- a/lib/middleman/core_extensions/sitemap.rb +++ b/lib/middleman/core_extensions/sitemap.rb @@ -12,12 +12,12 @@ module Middleman::CoreExtensions::Sitemap module InstanceMethods def initialize super - - file_changed do |file| + + file_changed %r{^source/} do |file| sitemap.touch_file(file) end - - file_deleted do |file| + + file_deleted %r{^source/} do |file| sitemap.remove_file(file) end end