mirror of
https://github.com/penpot/penpot.git
synced 2025-05-11 00:06:37 +02: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);
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue