Reputation: 908
I read some article about decreasing angular project size, in those articles I founded some solution but one of them was Obscure for me and that was gzipped compression, my question is how I can use gzip for my application?
If it helps you, I'm using asp.net core as my back-end technology.
Upvotes: 2
Views: 2135
Reputation: 801
First, you need to install these two dev dependencies
"gulp": "^4.0.0",
"gulp-gzip": "^1.4.2",
Create a postbuild script in your package.json
"postbuild": "gulp compress",
Create a gulpfile.js file at the same level of package.json file with the following code
var gulp = require('gulp');
var gzip = require('gulp-gzip');
gulp.task('compress', function() {
return new Promise(function(resolve, reject) {
resolve(gulp.src(['./dist/**/*.*'])
.pipe(gzip())
.pipe(gulp.dest('./dist')));
})
});
Whenever you build your project this postbuild command will compress the files for after the build.
Upvotes: 5