demo27.js
const template = require('art-template');
//绝对路径 模板中显示的数据
const path = require('path');
const views = path.join(__dirname, '01.art');
const html = template(views, {name: '张三',age: 20,content: '<h1>我是歌谣</h1>'
});
console.log(html);
01.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><p>{{name}}</p><p>{{age}}</p><p>{{content}}</p><p><%=name%></p><p><%=1+2%></p><p><%=content%></p>
</body>
</html>
运行结果