该配置由 Modern.js Builder 提供,更多信息可参考 tools.pug。
true | Object | Function | undefined
false
配置 Pug 模板引擎。
Builder 默认不启用 Pug 模板引擎,你可以将 tools.pug
设置为 true
来启用它。
export default {
tools: {
pug: true,
},
};
启用后,你可以在 html.template
中指定使用 index.pug
作为模板文件。
当 tools.terser
的值为 Object
类型时,可以配置 Pug 模板引擎的选项:
export default {
tools: {
pug: {
doctype: 'xml',
},
},
};
详细参数请查看 Pug API Reference。
当 tools.pug
配置为 Function
类型时,默认配置作为第一个参数传入,可以直接修改配置对象,也可以返回一个值作为最终结果。
export default {
tools: {
pug(config) {
config.doctype = 'xml';
},
},
};