3.1.4 • Published 6 months ago
gulp-templatejs v3.1.4
gulp-templatejs
template.js的gulp插件。
安装
$ npm install --save @templatejs/runtime # 安装template运行时
$ npm install --save-dev gulp-templatejs # 安装template编译插件
配置
配置参数同template.js参数一样,其中expression参数会作为获取template的表达式。
var gulp = require('gulp');
var templatejs = require('gulp-templatejs');
gulp.task('build', function () {
gulp
.src(['src/**.tmpl'])
.pipe(
templatejs({
sTag: '<#',
eTag: '#>',
sandbox: false, // 沙箱模式
}),
)
.pipe(gulp.dest('dist'));
});
新建模版文件demo.tmpl
<div>
<#=abc#>
</div>
在js中require
模版文件,并渲染
var tpl = require('./demo.js'); // demo.tmpl -> demo.js
document.getElementById('test').innerHTML = tpl({ abc: 'yanhaijing' });
贡献者列表
:gear: 更新日志
:airplane: 计划列表
相关链接
3.1.2-alpha.0
6 months ago
3.1.4
6 months ago
3.1.3-alpha.0
6 months ago
3.0.0-alpha.0
6 months ago
3.1.0-alpha.0
6 months ago
2.6.0
8 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
2.2.1
4 years ago
2.2.0
4 years ago
2.1.0
4 years ago