====================
gulp plugin, compile html template into js file
npm install gulp-bigpipe-template --save-dev
Please use it before html-minified functions
var bpTpl = require('gulp-bigpipe-template');
gulp.task('tmpl', function() {
return gulp.src('./tmpl/*.html')
.pipe(bpTpl())
.pipe(gulp.dest('./tmpl/'));
});
<html>
<head>
<style></style>
</head>
<!-- bigpipe -->
<body>
<div></div>
<!-- bigpipe -->
<script></script>
</body>
</html>
var tpl0 = function() { return "<html>" +
"<head>" +
"<style></style>" +
"</head>";};
var tpl1 = function() { return "<body>" +
"<div></div>";};
var tpl2 = function() { return "<script></script>" +
"</body>" +
"</html>";};
module.exports = {tpl0: tpl0,tpl1: tpl1,tpl2: tpl2,};
Type: Object
Type: String
Default: __dirname.replace('node_modules\\' + PLUGIN_NAME, '') + "/server/tpl/"
template folder, if your project folder is under /Users/lcxfs1991/project/, and you hope to save the template filder under /Users/lcxfs1991/project/server/tpl, you can set this config as server/tpl/
Type: String
Default: Same as input html file
template filename
Type: String
Default: js
template file extension
Type: String
Default: "
quote char
Type: String
Default:
indention string
Type: Boolean
Default: true
Support html-minifier or not
Type: Object
Default: {removeComments: true, collapseWhitespace: true,}
html-minifier option
https://github.com/kangax/html-minifier
- 1.0.0 The first version
- 1.0.3 Fix tplFolder creation bug
- 1.1.0 Support html-minifier