谁能告诉我为什么pug api不能与他们文档页面上的简单示例一起工作
const pug = require('pug');
// Compile the source code
const compiledFunction = pug.compileFile('template.pug');
// Render a set of data
console.log(compiledFunction({
name: 'Timothy'
}));
// "<p>Timothy's Pug source code!</p>" 不管我做什么,它总是告诉pug.compileFile不是一个函数
发布于 2017-06-10 22:55:20
给定的代码对我来说工作得很好。这是我制作的一个Glitch instance来测试这一点。注意,控制台从template.pug模板中正确地注销了编译后的超文本标记语言。
话虽如此,请确保您已正确完成以下操作:
template.pug文件保存到正确的位置看一下这个小故障实例,您可能会找出问题所在。
https://stackoverflow.com/questions/44468375
复制相似问题