基礎核心程式碼
var template = require('art-template'); var tName = new Date().getTime(); var htmlT = '<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title></title></head><body><h1>{{title}}</h1></body></html>'; template(tName, htmlT); var html = template.renderFile(tName, {title: '大家好,我叫小白~'}); console.log("結果: " + html); res.end();
執行結果: