mirror of
https://github.com/penpot/penpot.git
synced 2025-04-04 11:01:20 -05:00
Add brotli and gzip static compression to gulp tasks.
This commit is contained in:
parent
6143fd3779
commit
e5651f6d5a
3 changed files with 177 additions and 2 deletions
|
@ -9,6 +9,8 @@ const rimraf = require("rimraf");
|
|||
const mustache = require("gulp-mustache");
|
||||
const rename = require("gulp-rename");
|
||||
const gulpif = require("gulp-if");
|
||||
const gzip = require("gulp-gzip");
|
||||
const brotli = require("gulp-brotli");
|
||||
|
||||
const paths = {};
|
||||
paths.app = "./resources/";
|
||||
|
@ -17,7 +19,6 @@ paths.dist = "./dist/";
|
|||
paths.target = "./target/";
|
||||
paths.scss = paths.app + "styles/**/*.scss";
|
||||
|
||||
|
||||
/***********************************************
|
||||
* Helper Tasks
|
||||
***********************************************/
|
||||
|
@ -178,9 +179,25 @@ gulp.task("dist:copy:images", function() {
|
|||
gulp.task("dist:copy", ["dist:copy:fonts",
|
||||
"dist:copy:images"]);
|
||||
|
||||
// GZip
|
||||
|
||||
gulp.task("dist:gzip", function() {
|
||||
return gulp.src(`${paths.dist}**/!(*.gz|*.br|*.jpg|*.png)`)
|
||||
.pipe(gzip({gzipOptions: {level: 9}}))
|
||||
.pipe(gulp.dest(paths.dist));
|
||||
});
|
||||
|
||||
gulp.task("dist:brotli", function() {
|
||||
return gulp.src(`${paths.dist}**/!(*.gz|*.br|*.jpg|*.png)`)
|
||||
.pipe(brotli.compress({quality: 10}))
|
||||
.pipe(gulp.dest(paths.dist));
|
||||
});
|
||||
|
||||
// Entry Point
|
||||
|
||||
gulp.task("dist", function(next) {
|
||||
runseq("dist:clean", ["dist:template", "dist:scss", "dist:copy"], next);
|
||||
runseq(["dist:clean"],
|
||||
["dist:template", "dist:scss", "dist:copy"],
|
||||
["dist:gzip", "dist:brotli"], next);
|
||||
});
|
||||
|
||||
|
|
156
frontend/npm-shrinkwrap.json
generated
156
frontend/npm-shrinkwrap.json
generated
|
@ -225,6 +225,12 @@
|
|||
"resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz",
|
||||
"dev": true
|
||||
},
|
||||
"bytes": {
|
||||
"version": "0.3.0",
|
||||
"from": "bytes@>=0.3.0 <0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/bytes/-/bytes-0.3.0.tgz",
|
||||
"dev": true
|
||||
},
|
||||
"camelcase": {
|
||||
"version": "2.1.1",
|
||||
"from": "camelcase@>=2.0.0 <3.0.0",
|
||||
|
@ -830,6 +836,12 @@
|
|||
"resolved": "https://registry.npmjs.org/gulp-autoprefixer/-/gulp-autoprefixer-3.1.1.tgz",
|
||||
"dev": true
|
||||
},
|
||||
"gulp-brotli": {
|
||||
"version": "1.2.0",
|
||||
"from": "gulp-brotli@latest",
|
||||
"resolved": "https://registry.npmjs.org/gulp-brotli/-/gulp-brotli-1.2.0.tgz",
|
||||
"dev": true
|
||||
},
|
||||
"gulp-css-base64": {
|
||||
"version": "1.3.4",
|
||||
"from": "gulp-css-base64@1.3.4",
|
||||
|
@ -958,6 +970,132 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"gulp-gzip": {
|
||||
"version": "1.4.0",
|
||||
"from": "gulp-gzip@latest",
|
||||
"resolved": "https://registry.npmjs.org/gulp-gzip/-/gulp-gzip-1.4.0.tgz",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"ansi-regex": {
|
||||
"version": "0.2.1",
|
||||
"from": "ansi-regex@>=0.2.0 <0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-0.2.1.tgz",
|
||||
"dev": true
|
||||
},
|
||||
"ansi-styles": {
|
||||
"version": "1.1.0",
|
||||
"from": "ansi-styles@>=1.1.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-1.1.0.tgz",
|
||||
"dev": true
|
||||
},
|
||||
"chalk": {
|
||||
"version": "0.5.1",
|
||||
"from": "chalk@>=0.5.0 <0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-0.5.1.tgz",
|
||||
"dev": true
|
||||
},
|
||||
"gulp-util": {
|
||||
"version": "2.2.20",
|
||||
"from": "gulp-util@>=2.2.14 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/gulp-util/-/gulp-util-2.2.20.tgz",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"through2": {
|
||||
"version": "0.5.1",
|
||||
"from": "through2@>=0.5.0 <0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/through2/-/through2-0.5.1.tgz",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"has-ansi": {
|
||||
"version": "0.1.0",
|
||||
"from": "has-ansi@>=0.1.0 <0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-0.1.0.tgz",
|
||||
"dev": true
|
||||
},
|
||||
"lodash._reinterpolate": {
|
||||
"version": "2.4.1",
|
||||
"from": "lodash._reinterpolate@>=2.4.1 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-2.4.1.tgz",
|
||||
"dev": true
|
||||
},
|
||||
"lodash.escape": {
|
||||
"version": "2.4.1",
|
||||
"from": "lodash.escape@>=2.4.1 <2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.escape/-/lodash.escape-2.4.1.tgz",
|
||||
"dev": true
|
||||
},
|
||||
"lodash.keys": {
|
||||
"version": "2.4.1",
|
||||
"from": "lodash.keys@>=2.4.1 <2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-2.4.1.tgz",
|
||||
"dev": true
|
||||
},
|
||||
"lodash.template": {
|
||||
"version": "2.4.1",
|
||||
"from": "lodash.template@>=2.4.1 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-2.4.1.tgz",
|
||||
"dev": true
|
||||
},
|
||||
"lodash.templatesettings": {
|
||||
"version": "2.4.1",
|
||||
"from": "lodash.templatesettings@>=2.4.1 <2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-2.4.1.tgz",
|
||||
"dev": true
|
||||
},
|
||||
"minimist": {
|
||||
"version": "0.2.0",
|
||||
"from": "minimist@>=0.2.0 <0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.2.0.tgz",
|
||||
"dev": true
|
||||
},
|
||||
"readable-stream": {
|
||||
"version": "1.0.34",
|
||||
"from": "readable-stream@>=1.0.17 <1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz",
|
||||
"dev": true
|
||||
},
|
||||
"strip-ansi": {
|
||||
"version": "0.3.0",
|
||||
"from": "strip-ansi@>=0.3.0 <0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.3.0.tgz",
|
||||
"dev": true
|
||||
},
|
||||
"supports-color": {
|
||||
"version": "0.2.0",
|
||||
"from": "supports-color@>=0.2.0 <0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-0.2.0.tgz",
|
||||
"dev": true
|
||||
},
|
||||
"through2": {
|
||||
"version": "0.4.2",
|
||||
"from": "through2@>=0.4.1 <0.5.0",
|
||||
"resolved": "https://registry.npmjs.org/through2/-/through2-0.4.2.tgz",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"xtend": {
|
||||
"version": "2.1.2",
|
||||
"from": "xtend@>=2.1.1 <2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/xtend/-/xtend-2.1.2.tgz",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"vinyl": {
|
||||
"version": "0.2.3",
|
||||
"from": "vinyl@>=0.2.1 <0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/vinyl/-/vinyl-0.2.3.tgz",
|
||||
"dev": true
|
||||
},
|
||||
"xtend": {
|
||||
"version": "3.0.0",
|
||||
"from": "xtend@>=3.0.0 <3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/xtend/-/xtend-3.0.0.tgz",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"gulp-if": {
|
||||
"version": "2.0.2",
|
||||
"from": "gulp-if@2.0.2",
|
||||
|
@ -1124,6 +1262,12 @@
|
|||
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz",
|
||||
"dev": true
|
||||
},
|
||||
"iltorb": {
|
||||
"version": "1.0.13",
|
||||
"from": "iltorb@>=1.0.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/iltorb/-/iltorb-1.0.13.tgz",
|
||||
"dev": true
|
||||
},
|
||||
"in-publish": {
|
||||
"version": "2.0.0",
|
||||
"from": "in-publish@>=2.0.0 <3.0.0",
|
||||
|
@ -1900,6 +2044,12 @@
|
|||
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-3.0.0.tgz",
|
||||
"dev": true
|
||||
},
|
||||
"object-keys": {
|
||||
"version": "0.4.0",
|
||||
"from": "object-keys@>=0.4.0 <0.5.0",
|
||||
"resolved": "https://registry.npmjs.org/object-keys/-/object-keys-0.4.0.tgz",
|
||||
"dev": true
|
||||
},
|
||||
"object.omit": {
|
||||
"version": "2.0.1",
|
||||
"from": "object.omit@>=2.0.0 <3.0.0",
|
||||
|
@ -2358,6 +2508,12 @@
|
|||
"resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.0.tgz",
|
||||
"dev": true
|
||||
},
|
||||
"stream-to-array": {
|
||||
"version": "1.0.0",
|
||||
"from": "stream-to-array@>=1.0.0 <1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/stream-to-array/-/stream-to-array-1.0.0.tgz",
|
||||
"dev": true
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "0.10.31",
|
||||
"from": "string_decoder@>=0.10.0 <0.11.0",
|
||||
|
|
|
@ -18,8 +18,10 @@
|
|||
"devDependencies": {
|
||||
"gulp": "3.9.1",
|
||||
"gulp-autoprefixer": "3.1.1",
|
||||
"gulp-brotli": "^1.2.0",
|
||||
"gulp-css-base64": "1.3.4",
|
||||
"gulp-cssmin": "0.1.7",
|
||||
"gulp-gzip": "^1.4.0",
|
||||
"gulp-if": "2.0.2",
|
||||
"gulp-mustache": "2.3.0",
|
||||
"gulp-plumber": "1.1.0",
|
||||
|
|
Loading…
Add table
Reference in a new issue