Module | Tilt::CompileSite |
In: |
lib/sinatra/tilt.rb
|
Mixin allowing template compilation on scope objects.
Including this module in scope objects passed to Template#render causes template source to be compiled to methods the first time they‘re used. This can yield significant (5x-10x) performance increases for templates that support it (ERB, Erubis, Builder).
It‘s also possible (though not recommended) to include this module in Object to enable template compilation globally. The downside is that the template methods will polute the global namespace and could lead to unexpected behavior.