Skip to content

Commit

Permalink
feature: minify HTML when merge
Browse files Browse the repository at this point in the history
  • Loading branch information
kayo5994 committed Jan 7, 2019
1 parent cdf3f3d commit 92943ab
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"gulp-debug": "^4.0.0",
"gulp-file-include": "^2.0.1",
"gulp-file-sync": "^2.0.0",
"gulp-htmlmin": "^5.0.1",
"gulp-if": "^2.0.2",
"gulp-imagemin": "^5.0.3",
"gulp-load-plugins": "^1.5.0",
Expand Down
4 changes: 4 additions & 0 deletions workflow/basicTasks/merge.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ module.exports = (gulp, mix) => {
// 变更文件引用路径
gulp.src(mix.config.paths.htmlResultPath + '/**/*.html')
.pipe(mergeReference(mergeRule))
.pipe(mix.plugins.htmlmin({
removeComments: true,
collapseWhitespace: true
}))
.pipe(gulp.dest(mix.config.paths.htmlResultPath));
mix.util.log('Merge', '文件合并变更已完成');

Expand Down
11 changes: 10 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3516,6 +3516,15 @@ gulp-file-sync@^2.0.0:
fs-extra "^5.0.0"
plugin-error "^0.1.2"

gulp-htmlmin@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/gulp-htmlmin/-/gulp-htmlmin-5.0.1.tgz#90fc5e8ad0425a9e86d5d521427184e7276365e7"
integrity sha512-ASlyDPZOSKjHYUifYV0rf9JPDflN9IRIb8lw2vRqtYMC4ljU3zAmnnaVXwFQ3H+CfXxZSUesZ2x7jrnPJu93jA==
dependencies:
html-minifier "^3.5.20"
plugin-error "^1.0.1"
through2 "^2.0.3"

gulp-if@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/gulp-if/-/gulp-if-2.0.2.tgz#a497b7e7573005041caa2bc8b7dda3c80444d629"
Expand Down Expand Up @@ -3852,7 +3861,7 @@ html-comment-regex@^1.1.0:
resolved "https://registry.yarnpkg.com/html-comment-regex/-/html-comment-regex-1.1.2.tgz#97d4688aeb5c81886a364faa0cad1dda14d433a7"
integrity sha512-P+M65QY2JQ5Y0G9KKdlDpo0zK+/OHptU5AaBwUfAIDJZk1MYf32Frm84EcOytfJE0t5JvkAnKlmjsXDnWzCJmQ==

html-minifier@^3.3.1:
html-minifier@^3.3.1, html-minifier@^3.5.20:
version "3.5.21"
resolved "https://registry.yarnpkg.com/html-minifier/-/html-minifier-3.5.21.tgz#d0040e054730e354db008463593194015212d20c"
integrity sha512-LKUKwuJDhxNa3uf/LPR/KVjm/l3rBqtYeCOAekvG8F1vItxMUpueGd94i/asDDr8/1u7InxzFA5EeGjhhG5mMA==
Expand Down

0 comments on commit 92943ab

Please sign in to comment.