Алексей Asked:2020-06-08 17:02:11 +0000 UTC2020-06-08 17:02:11 +0000 UTC 2020-06-08 17:02:11 +0000 UTC phpStorm HTML 缩小 772 phpStorm 是否能够像“YUI Compressor JS”/CSS 插件一样自动缩小 HTML 文件? 问题是,如果不进行最小化,HTML 文件会更大,文件中的换行会影响页面在浏览器中的显示。 html 1 个回答 Voted Best Answer lena 2020-06-09T01:12:01Z2020-06-09T01:12:01Z PhpStorm 没有内置的 HTML 文件自动最小化,但很容易添加。 npm install html-minifier -g 在设置 | 工具 | 文件观察器,使用自定义模板添加新的文件观察器 在Program字段中,指定 html-minifier 的完整路径 在参数字段中,添加以下内容。论据: $FileName$ --collapse-boolean-attributes --collapse-whitespace --html5 --remove-attribute-quotes --remove-comments --remove-empty-attributes --remove-optional-tags --remove-redundant-attributes --remove-script-type-attributes --remove-style-link-type-attributes --remove-tag-whitespace --sort-attributes --sort-class-name --trim-custom-fragments --use-short-doctype --minify-js -o $FileNameWithoutExtension$.min.html 在Output paths to refresh字段中,指定$FileNameWithoutExtension$.min.html 工作目录:$FileDir$ html-notifier 选项的完整列表可通过 command 获得html-minifier --help。见https://github.com/kangax/html-minifier
PhpStorm 没有内置的 HTML 文件自动最小化,但很容易添加。
npm install html-minifier -g$FileName$ --collapse-boolean-attributes --collapse-whitespace --html5 --remove-attribute-quotes --remove-comments --remove-empty-attributes --remove-optional-tags --remove-redundant-attributes --remove-script-type-attributes --remove-style-link-type-attributes --remove-tag-whitespace --sort-attributes --sort-class-name --trim-custom-fragments --use-short-doctype --minify-js -o $FileNameWithoutExtension$.min.html在Output paths to refresh字段中,指定
$FileNameWithoutExtension$.min.html工作目录:
$FileDir$html-notifier 选项的完整列表可通过 command 获得
html-minifier --help。见https://github.com/kangax/html-minifier