2.9.0 • Published 7 months ago

parcel-plugin-template v2.9.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 months ago

parcel-plugin-template

npm.io

template.js的 parcel v1 编译插件。

安装

$ npm install --save @templatejs/runtime # 安装template运行时
$ npm install --save-dev parcel-plugin-template # 安装template编译插件

配置

配置参数同template.js参数一样,其中expression参数会作为获取template的表达式。

parcel会自动加载parcel-plugin-template插件,可以通过template.config.json文件自定义配置

{
    "sTag": "<#",
    "eTag": "#>",
    "expression": "require(\"@templatejs/runtime\").default", // 获取template的表达式,如 `window.template`
    "sandbox": false, // 沙箱模式
}

新建模版文件demo.tmpl(后缀名必须为tmpl)

<div>
    <#=abc#>
</div>

在js中import模版文件,并渲染

import tpl from './demo.tmpl';

document.getElementById('test').innerHTML = tpl({abc: 'yanhaijing'});

贡献者列表

contributors

:gear: 更新日志

CHANGELOG.md

:airplane: 计划列表

TODO.md

2.9.0

7 months ago

2.8.3

7 months ago

2.8.2

7 months ago

2.4.2

4 years ago

2.4.1

4 years ago

2.4.0

4 years ago

2.3.0

4 years ago