module Roda::RodaPlugins::AdditionalViewDirectories

The additional_view_directories plugin allows for specifying additional view directories to look in for templates. When rendering a template, it will first try the :views directory specified in the render plugin. If the template file to be rendered does not exist in that directory, it will try each additional view directory specified in this plugin, in order, using the path to the first template file that exists in the file system. If no such path is found, it uses the default path specified by the render plugin.

Example:

plugin :render, :views=>'dir'
plugin :additional_view_directories, ['dir1', 'dir2', 'dir3']

route do |r|
  # Will check the following in order, using path for first
  # template file that exists:
  # * dir/t.erb
  # * dir1/t.erb
  # * dir2/t.erb
  # * dir3/t.erb
  render :t
end