Doppu
Doppu

Reputation: 495

I need enable text compression to optimize my time

When I run "Lighthouse" in my angular app it show me that I have to enable a text compress . I cannot modify server configure so I follow this tutorial:

how to enable gzip compression in angular cli for production build

I Installed dependencies first and after and I put the file gulpfile.js in the same directory as package.json:

var gulp = require('gulp');
var gzip = require('gulp-gzip');

gulp.task('compress', function () {
    return gulp.src(['./dist/**/*.*'])
        .pipe(gzip())
        .pipe(gulp.dest('./dist'));
});

I modify my package.json in:

"scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "postbuild": "gulp compress",
    "watch": "ng build --watch --configuration development",
    "test": "ng test"
},

but when I run the

ng build --watch --base-href /Strudent/

when I run Lighthouse I show me the same problem. Can anyone help me?

Upvotes: 1

Views: 246

Answers (0)

Related Questions