我想用gulp的uglify插件縮小我的web組件,但它失敗,因爲它不能識別自定義html標記。Uglify/minify使用gulp聚合物Web組件
是否有任何的gulp插件可以縮小含有自定義標籤的html?
我想用gulp的uglify插件縮小我的web組件,但它失敗,因爲它不能識別自定義html標記。Uglify/minify使用gulp聚合物Web組件
是否有任何的gulp插件可以縮小含有自定義標籤的html?
試用gulp-htmlmin。
硫化後我用它來縮小我的elements.html文件,但我想它應該也適用於非硫化元素。 以下是我在我的gulp文件中調用插件的方法:
.pipe(htmlmin({
removeEmptyAttributes: true,
customAttrAssign: [{"source":"\\$="}],
customAttrSurround: [
[ {"source": "\\({\\{"}, {"source": "\\}\\}"} ],
[ {"source": "\\[\\["}, {"source": "\\]\\]"} ]
],
collapseWhitespace: true,
// always leave one space
// because http://perfectionkills.com/experimenting-with-html-minifier/#collapse_whitespace
conservativeCollapse: true,
minifyJS: true,
minifyCSS: true,
removeComments: true,
removeCommentsFromCDATA: true,
removeCDATASectionsFromCDATA: true
}))
這是一個很好的答案!謝謝 –