首先使用node导入art文件
const template = require('art-template');
const path = require('path');
//拼接路径
const route = path.join(__dirname,'02.art');
const html = template(route,{
name:'wwx',
love:'fj'
})
console.log(html);
具体的判断语法
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<!-- 标准语法的条件判断语句-->
{{if name == 'wwx'}} <!-- name 只有是fj的时候 才会指向12行代码 -->
{{name}}
{{ else if love == 'fj'}} <!-- 多分支语句的写法-->
{{love}}
{{/if}}
<!-- 原始语法的写法-->
<% if(name == 'wwx') { %>
<%= name%>
<%} else if(love == 'fj') { %>
珏
<% } %>
</body>
</html>