I have a fairly large Metalsmith project using Nunjucks for templating (i.e. using metalsmith-in-place
, which uses jstransformer-nunjucks
):
const Metalsmith = require('metalsmith'),
inplace = require('metalsmith-in-place');
Metalsmith(__dirname)
.metadata(metadata)
.source('./src')
.destination('./build')
.use(inplace({
engineOptions: {
root: path.join(__dirname, 'src')
}
}))
.build(function(err) {
if (err) {
throw err;
}
});
When I run my build script, I get a template error from a template with an "unknown path":
> project@0.4.0 build ~/project
> node build.js
~/project/build.js:155
throw err;
^
Template render error: (unknown path) [Line 13, Column 6]
unknown block tag: greetingSection
at Object._prettifyError (~/project/node_modules/nunjucks/src/lib.js:36:11)
at Template.init (~/project/node_modules/nunjucks/src/environment.js:515:19)
at Template.Obj (~/project/node_modules/nunjucks/src/object.js:64:15)
at new Template (~/project/node_modules/nunjucks/src/environment.js:482:18)
at Object.compile (~/project/node_modules/nunjucks/index.js:85:12)
at Object.exports.compile (~/project/node_modules/jstransformer-nunjucks/index.js:50:29)
at Transformer.render (~/project/node_modules/jstransformer/index.js:288:44)
at resolve (~/project/node_modules/metalsmith-in-place/lib/index.js:60:33)
at new Promise (<anonymous>)
at render (~/project/node_modules/metalsmith-in-place/lib/index.js:29:10)
I have no idea which of my many Nunjucks files is causing the error. How to I get metalsmith-in-place to give me the path of the file causing the issue?