NAME

Skilletor::Render::Loader - A Nunjucks loader confined to an item's source root – the reference's makeLoader

VERSION

version 0.008000

SYNOPSIS

use Text::Nunjucks::Environment;
use Skilletor::Render::Loader;

my $env = Text::Nunjucks::Environment->new( Skilletor::Render::Loader->new( root => $source_dir ),
  { autoescape => !!0, throwOnUndefined => !!1 } );

DESCRIPTION

The loader Skilletor::Render renders an item's templates through: a Text::Nunjucks::Loader that serves files of one source tree, the reference's makeLoader (spec §5). A template, an include, an import or a macro file is looked up by its path relative to the source root; a name that resolves outside it – ../x.md, /etc/passwd – throws a Skilletor::Error::Render template escapes source root: <name>. A file is read as UTF-8 the way Node reads it (an ill-formed sequence becomes U+FFFD) and never cached.

root

The source root, the item's source tree.

get_source

$loader->get_source('snippets/shared.md');   # { src, path, noCache }

The template's source and absolute path, or undef when there is no such file.

is_relative

False for every name: a name is always relative to the source root, never to the template that includes it.

SUPPORT

Issues

Please report bugs and feature requests at https://github.com/Getty/skilletor/issues.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <torsten@raudssus.de>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)