This is an automated email from the ASF dual-hosted git repository.
zregvart pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-website.git
The following commit(s) were added to refs/heads/master by this push:
new 69046de CAMEL-11492: add HTML minification
69046de is described below
commit 69046defd318b1072918007d7a6fb396a5397e9f
Author: Zoran Regvart <[email protected]>
AuthorDate: Fri Dec 14 21:51:48 2018 +0100
CAMEL-11492: add HTML minification
---
gulpfile.js | 20 ++++++++++++----
package.json | 4 +++-
yarn.lock | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++------
3 files changed, 90 insertions(+), 12 deletions(-)
diff --git a/gulpfile.js b/gulpfile.js
index 3125474..b5beedc 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -1,8 +1,20 @@
-var gulp = require('gulp');
-var critical = require('critical').stream;
-
-gulp.task('critical', function () {
+const gulp = require('gulp');
+const critical = require('critical').stream;
+const htmlmin = require('gulp-htmlmin');
+
+gulp.task('critical', () => {
return gulp.src('public/**/index.html')
.pipe(critical({base: 'public/', inline: true}))
.pipe(gulp.dest('public'));
});
+
+gulp.task('minify', () => {
+ return gulp.src('public/**/*.html')
+ .pipe(htmlmin({
+ collapseBooleanAttributes: true,
+ collapseWhitespace: true,
+ collapseInlineTagWhitespace: true,
+ useShortDoctype: true
+ }))
+ .pipe(gulp.dest('public'));
+});
diff --git a/package.json b/package.json
index 666ee34..bb319b9 100644
--- a/package.json
+++ b/package.json
@@ -4,13 +4,15 @@
"documentation": "antora --redirect-facility disabled site.yml",
"website": "hugo --minify",
"critical": "gulp critical",
- "build": "run-s theme documentation website critical"
+ "minify": "gulp minify",
+ "build": "run-s theme documentation website minify critical"
},
"devDependencies": {
"@antora/cli": "^2.0.0-beta.1",
"@antora/site-generator-default": "^2.0.0-beta.1",
"critical": "^1.3.4",
"gulp": "^4.0.0",
+ "gulp-htmlmin": "^5.0.1",
"hugo-bin": "^0.39.0",
"npm-run-all": "^4.1.5"
}
diff --git a/yarn.lock b/yarn.lock
index 575a813..059afd6 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -816,6 +816,14 @@ call-me-maybe@^1.0.1:
resolved
"https://registry.yarnpkg.com/call-me-maybe/-/call-me-maybe-1.0.1.tgz#26d208ea89e37b5cbde60250a15f031c16a4d66b"
integrity sha1-JtII6onje1y95gJQoV8DHBak1ms=
[email protected]:
+ version "3.0.0"
+ resolved
"https://registry.yarnpkg.com/camel-case/-/camel-case-3.0.0.tgz#ca3c3688a4e9cf3a4cda777dc4dcbc713249cf73"
+ integrity sha1-yjw2iKTpzzpM2nd9xNy8cTJJz3M=
+ dependencies:
+ no-case "^2.2.0"
+ upper-case "^1.1.1"
+
camelcase-keys@^2.0.0:
version "2.1.0"
resolved
"https://registry.yarnpkg.com/camelcase-keys/-/camelcase-keys-2.1.0.tgz#308beeaffdf28119051efa1d932213c91b8f92e7"
@@ -980,7 +988,7 @@ class-utils@^0.3.5:
isobject "^3.0.0"
static-extend "^0.1.1"
-clean-css@^4.1.9, clean-css@^4.2.1:
[email protected], clean-css@^4.1.9, clean-css@^4.2.1:
version "4.2.1"
resolved
"https://registry.yarnpkg.com/clean-css/-/clean-css-4.2.1.tgz#2d411ef76b8569b6d0c84068dabe85b0aa5e5c17"
integrity
sha512-4ZxI6dy4lrY6FHzfiy1aEOXgu4LIsW2MhwG0VBKdcoGoH/XLFgaHSdLTGr4O8Be6A8r3MOphEiI8Gc1n0ecf3g==
@@ -1102,16 +1110,16 @@ combined-stream@^1.0.6, combined-stream@~1.0.5,
combined-stream@~1.0.6:
dependencies:
delayed-stream "~1.0.0"
[email protected], commander@~2.17.1:
+ version "2.17.1"
+ resolved
"https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf"
+ integrity
sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==
+
commander@^2.18.0:
version "2.19.0"
resolved
"https://registry.yarnpkg.com/commander/-/commander-2.19.0.tgz#f6198aa84e5b83c46054b94ddedbfed5ee9ff12a"
integrity
sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==
-commander@~2.17.1:
- version "2.17.1"
- resolved
"https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf"
- integrity
sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==
-
commander@~2.8.1:
version "2.8.1"
resolved
"https://registry.yarnpkg.com/commander/-/commander-2.8.1.tgz#06be367febfda0c330aa1e2a072d3dc9762425d4"
@@ -2567,6 +2575,15 @@ gulp-cli@^2.0.0:
v8flags "^3.0.1"
yargs "^7.1.0"
+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-vinyl-zip@^2.1.0:
version "2.1.2"
resolved
"https://registry.yarnpkg.com/gulp-vinyl-zip/-/gulp-vinyl-zip-2.1.2.tgz#b79cc1a0e2c3b158ffee294590ade1e9caaf5e7b"
@@ -2706,6 +2723,11 @@ [email protected]:
resolved
"https://registry.yarnpkg.com/hash/-/hash-0.2.0.tgz#978654fa723b1252eea844e560c3931dad27289b"
integrity sha1-l4ZU+nI7ElLuqETlYMOTHa0nKJs=
[email protected]:
+ version "1.2.0"
+ resolved
"https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f"
+ integrity
sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==
+
homedir-polyfill@^1.0.1:
version "1.0.1"
resolved
"https://registry.yarnpkg.com/homedir-polyfill/-/homedir-polyfill-1.0.1.tgz#4c2bbc8a758998feebf5ed68580f76d46768b4bc"
@@ -2718,6 +2740,19 @@ hosted-git-info@^2.1.4:
resolved
"https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.7.1.tgz#97f236977bd6e125408930ff6de3eec6281ec047"
integrity
sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==
+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==
+ dependencies:
+ camel-case "3.0.x"
+ clean-css "4.2.x"
+ commander "2.17.x"
+ he "1.2.x"
+ param-case "2.1.x"
+ relateurl "0.2.x"
+ uglify-js "3.4.x"
+
htmlparser2@^3.9.1:
version "3.10.0"
resolved
"https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-3.10.0.tgz#5f5e422dcf6119c0d983ed36260ce9ded0bee464"
@@ -3540,6 +3575,11 @@ loud-rejection@^1.0.0:
currently-unhandled "^0.4.1"
signal-exit "^3.0.0"
+lower-case@^1.1.1:
+ version "1.1.4"
+ resolved
"https://registry.yarnpkg.com/lower-case/-/lower-case-1.1.4.tgz#9a2cabd1b9e8e0ae993a4bf7d5875c39c42e8eac"
+ integrity sha1-miyr0bno4K6ZOkv31YdcOcQujqw=
+
[email protected]:
version "1.0.0"
resolved
"https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-1.0.0.tgz#4e3366b39e7f5457e35f1324bdf6f88d0bfc7306"
@@ -3872,6 +3912,13 @@ nick@^0.1.3:
dependencies:
benchmark "^1.0.0"
+no-case@^2.2.0:
+ version "2.3.2"
+ resolved
"https://registry.yarnpkg.com/no-case/-/no-case-2.3.2.tgz#60b813396be39b3f1288a4c1ed5d1e7d28b464ac"
+ integrity
sha512-rmTZ9kz+f3rCvK2TD1Ue/oZlns7OGoIWP4fc3llxxRXlOkHKoWPPWJOfFYpITabSow43QJbRIoHQXtt10VldyQ==
+ dependencies:
+ lower-case "^1.1.1"
+
node-pre-gyp@^0.10.0:
version "0.10.3"
resolved
"https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.10.3.tgz#3070040716afdc778747b61b6887bf78880b80fc"
@@ -4254,6 +4301,13 @@ pako@^1.0.6:
resolved
"https://registry.yarnpkg.com/pako/-/pako-1.0.7.tgz#2473439021b57f1516c82f58be7275ad8ef1bb27"
integrity
sha512-3HNK5tW4x8o5mO8RuHZp3Ydw9icZXx0RANAOMzlMzx7LVXhMJ4mo3MOBpzyd7r/+RUu8BmndP47LXT+vzjtWcQ==
[email protected]:
+ version "2.1.1"
+ resolved
"https://registry.yarnpkg.com/param-case/-/param-case-2.1.1.tgz#df94fd8cf6531ecf75e6bef9a0858fbc72be2247"
+ integrity sha1-35T9jPZTHs915r75oIWPvHK+Ikc=
+ dependencies:
+ no-case "^2.2.0"
+
parse-filepath@^1.0.1:
version "1.0.2"
resolved
"https://registry.yarnpkg.com/parse-filepath/-/parse-filepath-1.0.2.tgz#a632127f53aaf3d15876f5872f3ffac763d6c891"
@@ -4777,6 +4831,11 @@ registry-url@^3.0.3:
dependencies:
rc "^1.0.1"
[email protected]:
+ version "0.2.7"
+ resolved
"https://registry.yarnpkg.com/relateurl/-/relateurl-0.2.7.tgz#54dbf377e51440aca90a4cd274600d3ff2d888a9"
+ integrity sha1-VNvzd+UUQKypCkzSdGANP/LYiKk=
+
remove-bom-buffer@^3.0.0:
version "3.0.0"
resolved
"https://registry.yarnpkg.com/remove-bom-buffer/-/remove-bom-buffer-3.0.0.tgz#c2bf1e377520d324f623892e33c10cac2c252b53"
@@ -5641,7 +5700,7 @@ typedarray@^0.0.6:
resolved
"https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
-uglify-js@^3.1.4, uglify-js@^3.4.9:
[email protected], uglify-js@^3.1.4, uglify-js@^3.4.9:
version "3.4.9"
resolved
"https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.4.9.tgz#af02f180c1207d76432e473ed24a28f4a782bae3"
integrity
sha512-8CJsbKOtEbnJsTyv6LE6m6ZKniqMiFWmm9sRbopbkGs3gMPPfd3Fh8iIA4Ykv5MgaTbqHr4BaoGLJLZNhsrW1Q==
@@ -5749,6 +5808,11 @@ update-notifier@^0.7.0:
semver-diff "^2.0.0"
xdg-basedir "^2.0.0"
+upper-case@^1.1.1:
+ version "1.1.3"
+ resolved
"https://registry.yarnpkg.com/upper-case/-/upper-case-1.1.3.tgz#f6b4501c2ec4cdd26ba78be7222961de77621598"
+ integrity sha1-9rRQHC7EzdJrp4vnIilh3ndiFZg=
+
uri-js@^4.2.2:
version "4.2.2"
resolved
"https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0"