Module: Roda::RodaPlugins::AdditionalRenderEngines
- Defined in:
- lib/roda/plugins/additional_render_engines.rb
Overview
The additional_render_engines plugin allows for specifying additional render engines to consider for templates. When rendering a template, it will first try the default template engine specified in the render plugin. If the template file to be rendered does not exist, it will try each additional render engine 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 # default engine is 'erb'
plugin :additional_render_engines, ['haml', 'str']
route do |r|
# Will check the following in order, using path for first
# template file that exists:
# * views/t.erb
# * views/t.haml
# * views/t.str
render :t
end
Defined Under Namespace
Modules: InstanceMethods
Class Method Summary collapse
-
.configure(app, render_engines) ⇒ Object
Set the additional render engines to consider.
- .load_dependencies(app, render_engines) ⇒ Object
Class Method Details
.configure(app, render_engines) ⇒ Object
Set the additional render engines to consider.
33 34 35 |
# File 'lib/roda/plugins/additional_render_engines.rb', line 33 def self.configure(app, render_engines) app.opts[:additional_render_engines] = render_engines.dup.freeze end |
.load_dependencies(app, render_engines) ⇒ Object
28 29 30 |
# File 'lib/roda/plugins/additional_render_engines.rb', line 28 def self.load_dependencies(app, render_engines) app.plugin :render end |