module Roda::RodaPlugins::PrecompileTemplates::ClassMethods

def precompile_templates(pattern, opts=OPTS)

for details.
Precompile the templates using the given options. See PrecompileTemplates
def precompile_templates(pattern, opts=OPTS)
  if pattern.is_a?(Hash)
    opts = pattern.merge(opts)
  end
  locals = opts[:locals] || []
  if locals && self.opts[:precompile_templates_sort]
    locals = locals.sort{|x,y| x.to_s <=> y.to_s}
  end
  compile_opts = if pattern.is_a?(Hash)
    [opts]
  else
    Dir[pattern].map{|file| opts.merge(:path=>File.expand_path(file))}
  end
  instance = allocate
  compile_opts.each do |compile_opt|
    template = instance.send(:retrieve_template, compile_opt)
    template.send(:compiled_method, locals)
  end
  nil
end