dmcb / silverstripe-html-minification
对Silverstripe HTTP响应的HTML进行压缩
0.1.0
2017-11-20 22:47 UTC
Requires
- silverstripe/framework: ^4.0
- silverstripe/vendor-plugin: ^1.0
- voku/html-min: ^1.0
This package is not auto-updated.
Last update: 2024-09-29 03:41:51 UTC
README
描述
压缩SilverStripe HTTP响应的HTML。
要求
- SilverStripe 4.x
使用方法
在 mysite/_config/config.yml
中为您的项目定义HTML压缩设置。以下是默认值
dmcb\HTMLMinification\Extensions\HTMLMinificationExtension:
doOptimizeViaHtmlDomParser: true // optimize html via "HtmlDomParser()"
doRemoveComments: true // remove default HTML comments (depends on "doOptimizeViaHtmlDomParser(true)")
doSumUpWhitespace: true // sum-up extra whitespace from the Dom (depends on "doOptimizeViaHtmlDomParser(true)")
doRemoveWhitespaceAroundTags: false // remove whitespace around tags (depends on "doOptimizeViaHtmlDomParser(true)")
doOptimizeAttributes: true // optimize html attributes (depends on "doOptimizeViaHtmlDomParser(true)")
doRemoveHttpPrefixFromAttributes: true // remove optional "http:"-prefix from attributes (depends on "doOptimizeAttributes(true)")
doRemoveDefaultAttributes: false // remove defaults (depends on "doOptimizeAttributes(true)" | disabled by default)
doRemoveDeprecatedAnchorName: true // remove deprecated anchor-jump (depends on "doOptimizeAttributes(true)")
doRemoveDeprecatedScriptCharsetAttribute: true // remove deprecated charset-attribute - the browser will use the charset from the HTTP-Header, anyway (depends on "doOptimizeAttributes(true)")
doRemoveDeprecatedTypeFromScriptTag: true // remove deprecated script-mime-types (depends on "doOptimizeAttributes(true)")
doRemoveDeprecatedTypeFromStylesheetLink: true // remove "type=text/css" for css links (depends on "doOptimizeAttributes(true)")
doRemoveEmptyAttributes: true // remove some empty attributes (depends on "doOptimizeAttributes(true)")
doRemoveValueFromEmptyInput: true // remove 'value=""' from empty <input> (depends on "doOptimizeAttributes(true)")
doSortCssClassNames: true // sort css-class-names, for better gzip results (depends on "doOptimizeAttributes(true)")
doSortHtmlAttributes: true // sort html-attributes, for better gzip results (depends on "doOptimizeAttributes(true)")
doRemoveSpacesBetweenTags: false // remove more (aggressive) spaces in the dom (disabled by default)
并扩展任何ContentControllers以启用该控制器索引输出的HTML压缩
ContentController:
extensions:
- dmcb\HTMLMinification\Extensions\HTMLMinificationExtension