const template = require('art-template');
//绝对路径 模板中显示的数据
const path = require('path');
const views = path.join(__dirname, '07.art');
const dateFormat = require('dateFormat')
template.defaults.imports.dateFormat = dateFormat;
const html = template(views, {time: new Date()});
console.log(html);
07.art
{{dateFormat(time,'yyyy-MM-dd')}}
运行结果