const template = require('art-template');
//绝对路径 模板中显示的数据
const path = require('path');
const views = path.join(__dirname, 'index.art');
const html = template(views, {name: '张三',age: 20
});
console.log(html);
index.art
<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title>
</head>
<body>{{name}}{{age}}
</body>
</html>
运行结果