const template = require('art-template');
//绝对路径 模板中显示的数据
const path = require('path');
const views = path.join(__dirname, '04.art');
const html = template(views, {msg: '我是首页',name: 'geyao',age: 20
});
console.log(html);
04.art
{{include'./index.art'}}
{{msg}}
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>
运行结果