load template.rb files from local templates

This commit is contained in:
Thomas Reynolds 2012-03-03 16:52:49 -08:00
parent 70dc453c25
commit c2f498e26e

View file

@ -17,5 +17,12 @@ end
# Iterate over the directories in the templates path and register each one.
Dir[File.join(Middleman::Templates::Local.source_root, "*")].each do |dir|
next unless File.directory?(dir)
Middleman::Templates.register(File.basename(dir).to_sym, Middleman::Templates::Local)
template_file = File.join(dir, "template.rb")
if File.exists?(template_file)
require template_file
else
Middleman::Templates.register(File.basename(dir).to_sym, Middleman::Templates::Local)
end
end