browserify-templatejs
TypeScript icon, indicating that this package has built-in type declarations

3.1.4 • Public • Published

template.js的browserify编译插件。

安装

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

配置

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

通过命令行加载browserify-templatejs插件

browserify -t browserify-templatejs index.js > bundle.js

可以通过template.config.json文件自定义配置

{
  "sTag": "<#",
  "eTag": "#>",
  "sandbox": false // 沙箱模式
}

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

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

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

// index.js
import tpl from './demo.tmpl';

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

贡献者列表

contributors

⚙️ 更新日志

CHANGELOG.md

✈️ 计划列表

TODO.md

Readme

Keywords

none

Package Sidebar

Install

npm i browserify-templatejs

Weekly Downloads

2

Version

3.1.4

License

MIT

Unpacked Size

9.63 kB

Total Files

6

Last publish

Collaborators

  • yanhaijing