Package Exports
- gulp-art-tpl
- gulp-art-tpl/lib/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (gulp-art-tpl) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
gulp-art-tpl
A gulp plugin for art-template.
用于解析 art-template 模板引擎语法的gulp插件。它能让你快速在 Gulp 工作流中处理 art-template 文件。
Install
npm install --save-dev gulp-art-tplUsage
const gulp = require('gulp')
const template = require('gulp-art-tpl')
const rename = require('gulp-rename')
gulp.task('build:html', function() {
gulp.src('./src/*.{art,html,ejs}')
.pipe(template({
title: 'art-template',
author: 'Mervin'
}))
.pipe(rename({
extname: '.html'
}))
.pipe(gulp.dest('dist/'))
})<!-- demo.html -->
<div>
<h1>{{title}}</h1>
<p>{{author}}</p>
</div>
<!-- or -->
<div>
<h1><%= title %></h1>
<p><%= author%></p>
</div>Output:
<div>
<h1>art template</h1>
<p>Mervin</p>
</div>
art-template同时支持标准语法和原始语法;- 原始语法兼容
EJS,LoDash模板。
API
template(data, options)data
需要渲染的数据
type-object
options
编译选项,具体查看 template.defaults
type-object