https://github.com/kangax/html-minifier#options-quick-referencejavascript
一、参数列表css
option | Description | Default |
removeComments | 删除注释,可是会保留script和style中的注释 | false |
removeCommentsFromCDATA | 从脚本和样式删除的注释 | false |
removeCDATASectionsFromCDATA | 删除CDATA节从脚本和样式元素 | |
collapseWhitespace | 删除空格,可是不会删除SCRIPT、style和textarea中的空格 | |
conservativeCollapse | 删除空格,老是保留一个空格 | |
preserveLineBreaks | ||
collapseBooleanAttributes | 省略只有boolean值的属性值,好比:readonly checked | |
removeAttributeQuotes | 删除引号,删除不须要引号的值。html 例如:java var input = '<p class="foo-bar" id="moo" title="blah blah">foo</p>';git var output = minify(input, { removeAttributeQuotes: true });github output; // '<p class="foo-bar" id=moo title="blah blah">foo</p>'api |
|
removeRedundantAttributes | 删除多余的属性 | |
preventAttributesEscaping | ||
useShortDoctype | 使用短的文档类型 | |
removeEmptyAttributes | 删除空属性 | |
removeScriptTypeAttributes | 删除script的类型属性,在h5下面script的type默认值:text/javascript | |
removeStyleLinkTypeAttributes | 删除style的类型属性,同上 | |
removeOptionalTags | ||
removeIgnored | 删除指定开头和结尾的内容 以逗号分割 | |
removeEmptyElements | 删除空元素 | |
lint | ||
keepClosingSlash | ||
caseSensitive | ||
minifyJS | 压缩js | |
minifyCSS | 压缩css | |
minifyURLs | 压缩url | |
ignoreCustomComments | 忽略指定的注释内容 | |
processScripts | ||
maxLineLength | 指定html输出的最大列数,超过就换行显示 | |
customAttrAssign | 容许的自定义属性列表 | |
customAttrSurround | ||
customAttrCollapse | 指定要换行的自定义属性(正则) |
更多能够参考做者例子:ui
http://perfectionkills.com/experimenting-with-html-minifier/url
注:经过本身验证而后结合翻译总结的描述,有错误的地方请指正,谢谢!spa