Dancer2::Template::Tiny(3pm)

Dancer2::Template::Tiny3pm

Template::tiny engine for dancer2

Usage

This template engine allows you to use Template::Tiny in Dancer2.

Template::Tiny is an implementation of a subset of Template::Toolkit (the major parts) which takes much less memory and is faster. If you're only using the main functions of Template::Toolkit, you could use Template::Tiny. You can also seamlessly move back to Template::Toolkit whenever you want.

However, Dancer2 uses a modified version of Template::Tiny, which is Dancer2::Template::Implementation::ForkedTiny. It adds 2 features :

•

opening and closing tag are now configurable

•

CodeRefs are evaluated and their results is inserted in the result.

You can read more on Dancer2::Template::Implementation::ForkedTiny.

To use this engine, all you need to configure in your Dancer2's "config.yaml":

    template: "tiny"

Of course, you can also set this while working using "set":

    # code code code
    set template => 'tiny';

Since Dancer2 has internal support for a wrapper-like option with the "layout" configuration option, you can have a Template::Toolkit-like WRAPPER even though Template::Tiny doesn't really support it.

Version

version 1.1.2

Methods

render($template, \%tokens)

Renders the template. The first arg is a filename for the template file or a reference to a string that contains the template. The second arg is a hashref for the tokens that you wish to pass to Template::Toolkit for rendering.

Releases

6 releases since Debian 8 (Jessie); the text changed 5 times.

  1. 8
  2. 9
  3. 10
  4. 11
  5. 12
  6. 13

Author

Dancer Core Developers

From libdancer2-perl 1.1.2+dfsg-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.