javascript [minify-html] #minify
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript [minify-html] #minify相关的知识,希望对你有一定的参考价值。
/*
https://www.npmjs.com/package/gulp-htmlmin
https://github.com/kangax/html-minifier
module uses the html-minifier module (has plenty of options)
*/
var gulp = require(gulp),
htmlmin = require(gulp-htmlmin);
gulp.task('htmltask', function(){
return gulp.src(['./dev/*.html','./dev/*.php'])
.pipe(htmlmin({
collapseWhitespace: true,
removeComments: true,
processConditionalComments: true,
minifyJS: true,
minifyCSS: true,
//processScripts: ['text/javascript'], //no
//Minify HTML, but don't touch PHP
ignoreCustomFragments: [ /<%[\s\S]*?%>/, /<\?[=|php]?[\s\S]*?\?>/ ] //ignore code starting with <? and <?php and ending with ?>.
}))
.pipe(gulp.dest('./site'));
});
//for recursive folder copy
'folder1/**/*.php'
以上是关于javascript [minify-html] #minify的主要内容,如果未能解决你的问题,请参考以下文章
javascript的题。
javascript JavaScript isset()等效: - JavaScript
JavaScript 使用JavaScript更改CSS(JavaScript)
JavaScript之基础-1 JavaScript(概述基础语法)
前端基础-JavaScript的基本概述和语法
JavaScript