标签:
安装
npm install gulp-content-includer
使用
var gulp = require(‘gulp‘);
var contentIncluder = require(‘gulp-content-includer‘);
var rename = require(‘gulp-rename‘);
gulp.task(‘concat‘,function() {
gulp.src("./content.html")
.pipe(contentIncluder({
includerReg:/<!\-\-include\s+"([^"]+)"\-\->/g
}))
.pipe(rename(‘index.html‘))
.pipe(gulp.dest(‘./‘));
});
说明
include语句模板自己随便定,只要把解析语句的正则传进去就行了,例:
<!--include "./footer.html"-->
gulp-content-includer--合并按模块引入的html文件
标签:
原文地址:http://www.cnblogs.com/enone/p/4809118.html