Home | 简体中文 | 繁体中文 | 杂文 | 打赏(Donations) | ITEYE 博客 | OSChina 博客 | Facebook | Linkedin | 知乎专栏 | Search | About

4.3. HTML Minification

		
npm install --save-dev gulp-minify-html
		
		

gulpfile.js:

		
// including plugins
var gulp = require('gulp');
var minifyHtml = require("gulp-minify-html");
 
// task
gulp.task('minify-html', function () {
    gulp.src('./html/*.html') // path to your files
    .pipe(minifyHtml())
    .pipe(gulp.dest('path/to/destination'));
});		
		
		

		
gulp minify-html
		
		

禁止处理 SSI 服务器端包含

		
gulp.task('minify-html', function () {
    gulp.src( src +'/cfd/*.html')
    .pipe(minifyHtml({ssi:true, quotes:false}))
    .pipe(gulp.dest( dist + '/cfd/'));
});