You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the base template directory is set to the directory of each template asset e.g. if the template is located at src/html/screens/page-1.html.njk, the base template directory for the nunjucks environment associated with that file is src/html/screens. nunjucks doesn't allow templates to be loaded "outside the box" of the template directory, for security reasons, so referencing a template in a parent directory (e.g. ../macros/util.html.njk) ends up failing silently, by default (with or without Parcel) e.g.:
src/html/screens/page-1.html.njk
{% import "../macros/util.html.njk" as util %}
<h1>Welcome to Page 1!</h1>
Adding error reporting doesn't help as nunjucks doesn't flag the violation where it occurs, which leads to a cryptic error downstream complaining that a file that exists is not found:
(This is mentioned in #4 (and #7), but is broken out here as improving the documentation is a separate issue.)
Affected directives:
Currently the base template directory is set to the directory of each template asset e.g. if the template is located at
src/html/screens/page-1.html.njk
, the base template directory for the nunjucks environment associated with that file issrc/html/screens
. nunjucks doesn't allow templates to be loaded "outside the box" of the template directory, for security reasons, so referencing a template in a parent directory (e.g.../macros/util.html.njk
) ends up failing silently, by default (with or without Parcel) e.g.:src/html/screens/page-1.html.njk
test-default.js
Output
Adding error reporting doesn't help as nunjucks doesn't flag the violation where it occurs, which leads to a cryptic error downstream complaining that a file that exists is not found:
test-error.js
Output
The text was updated successfully, but these errors were encountered: