NAME
Text::Nunjucks::Loader::Precompiled - 1:1 port of Nunjucks src/precompiled-loader.js -- templates from precompiled code objects
VERSION
version 0.001
DESCRIPTION
Serves templates from a hash of precompiled template objects keyed by name, a port of the PrecompiledLoader of Nunjucks src/precompiled-loader.js.
my $loader = Text::Nunjucks::Loader::Precompiled->new( { 'hi.njk' => \%compiled } );
A compiled template is the hash reference of code references that the Perl source emitted by Text::Nunjucks::Compiler evaluates to (a root entry and a b_NAME entry per block).
precompiled
Hash reference of the template names to their compiled objects.
new
Text::Nunjucks::Loader::Precompiled->new( \%compiled_templates );
Positional. Without a (true) argument the loader is empty.
get_source
my $source = $loader->get_source($name);
Returns { src => { type => 'code', obj => $compiled }, path => $name } for a name that is in the hash, otherwise undef. The result carries no noCache, so the Environment caches the template.
SUPPORT
Issues
Please report bugs and feature requests at https://github.com/Getty/p5-text-nunjucks/issues.
CONTRIBUTING
Contributions are welcome! Please fork the repository and submit a pull request.
AUTHOR
Torsten Raudssus <getty@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.