模板引擎 art-template

 

const template = require('art-template');
const path = require('path');

// template 方法是用来拼接字符串的
// 1. 模板路径 绝对路径
// 2. 要在模板中显示的数据 对象类型
// 返回拼接的字符串
const views = path.join(__dirname, 'views', 'index.art')
const html = template(views, {
    name: '张三',
    age: 20
})

console.log(html);
 
 

 

 

 

 

原文地址:https://www.cnblogs.com/ericblog1992/p/13092688.html