Micro-optimize some regexes

This commit is contained in:
Ben Hollis 2013-05-30 21:16:07 -07:00
parent fe2a7c4dd6
commit 7127401aa2

View file

@ -29,11 +29,11 @@ module Middleman
# Files starting with an dot, but not .htaccess # Files starting with an dot, but not .htaccess
:source_dotfiles => proc { |file| :source_dotfiles => proc { |file|
file =~ %r{/\.} && file !~ %r{/\.(htaccess|htpasswd)} file =~ %r{/\.} && file !~ %r{/\.ht(access|passwd)}
}, },
# Files starting with an underscore, but not a double-underscore # Files starting with an underscore, but not a double-underscore
:partials => proc { |file| file =~ %r{/_} && file !~ %r{/__} }, :partials => proc { |file| file =~ %r{/_[^_]} },
:layout => proc { |file, app| :layout => proc { |file, app|
file.start_with?(File.join(app.config[:source], 'layout.')) || file.start_with?(File.join(app.config[:source], 'layouts/')) file.start_with?(File.join(app.config[:source], 'layout.')) || file.start_with?(File.join(app.config[:source], 'layouts/'))