1Dancer2::Template::TinyU(s3e)r Contributed Perl DocumentaDtainocner2::Template::Tiny(3)
2
3
4
6 Dancer2::Template::Tiny - Template::Tiny engine for Dancer2
7
9 version 0.400001
10
12 This template engine allows you to use Template::Tiny in Dancer2.
13
14 Template::Tiny is an implementation of a subset of Template::Toolkit
15 (the major parts) which takes much less memory and is faster. If you're
16 only using the main functions of Template::Toolkit, you could use
17 Template::Tiny. You can also seamlessly move back to Template::Toolkit
18 whenever you want.
19
20 However, Dancer2 uses a modified version of Template::Tiny, which is
21 Dancer2::Template::Implementation::ForkedTiny. It adds 2 features :
22
23 • opening and closing tag are now configurable
24
25 • CodeRefs are evaluated and their results is inserted in the result.
26
27 You can read more on Dancer2::Template::Implementation::ForkedTiny.
28
29 To use this engine, all you need to configure in your Dancer2's
30 "config.yaml":
31
32 template: "tiny"
33
34 Of course, you can also set this while working using "set":
35
36 # code code code
37 set template => 'tiny';
38
39 Since Dancer2 has internal support for a wrapper-like option with the
40 "layout" configuration option, you can have a Template::Toolkit-like
41 WRAPPER even though Template::Tiny doesn't really support it.
42
44 render($template, \%tokens)
45 Renders the template. The first arg is a filename for the template
46 file or a reference to a string that contains the template. The second
47 arg is a hashref for the tokens that you wish to pass to
48 Template::Toolkit for rendering.
49
51 Dancer2, Dancer2::Core::Role::Template, Template::Tiny,
52 Dancer2::Template::Implementation::ForkedTiny.
53
55 Dancer Core Developers
56
58 This software is copyright (c) 2023 by Alexis Sukrieh.
59
60 This is free software; you can redistribute it and/or modify it under
61 the same terms as the Perl 5 programming language system itself.
62
63
64
65perl v5.38.0 2023-07-20 Dancer2::Template::Tiny(3)