原位金属匠给模板渲染错误:(未知路径)

时间:2019-03-18 14:53:43

标签: node.js static-site nunjucks metalsmith

我有一个相当大的Metalsmith项目,使用Nunjucks进行模板制作(即使用metalsmith-in-place,使用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;
    }
  });

运行构建脚本时,从带有“未知路径”的模板中收到模板错误:

> 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)

我不知道我的许多Nunjucks文件中的哪一个引起了错误。如何获得就位的金属匠给我引起问题的文件的路径?

0 个答案:

没有答案