npm i fast-ftl -S
import Render from "fast-ftl";
const {Render} = require("fast-ftl");
or
var Render = require("fast-ftl").Render;
var render = Render({
root: path.join(__dirname, 'pages'),
paths: [
path.join(__dirname, 'common')
], // Support MultiTemplateLoader
defaultEncoding: "utf-8", // 默认 encoding
urlEscapingCharsetSet: "utf-8", // URLEscapingCharset
numberFormat: "0.##########", // 数字格式化方式
templateUpdateDelay: 0 // milliseconds 为单位
});
property | Fast-FTL | defaultValue |
---|---|---|
default_encoding | defaultEncoding | utf-8 |
url_escaping_charset | urlEscapingCharsetSet | utf-8 |
number_format | numberFormat | 0.########## |
template_update_delay(Milliseconds) | templateUpdateDelay | 0 |
render.parse("test.ftl", {
YourName: "Jack"
}).then(data => {
console.log(data);
}).catch(e => {
console.log(e)
});
- Fast: use Socket to invoke Java Freemarker Parser, not in Teminal.
- Support MultiTemplate Directory.
- Simple API, base on Promise.
君羽 💻 🔌 🚇 📖 |
carryxyh 💻 |
---|
[![license][license-image]][license-url]