Reputation: 1232
I am using lite-server locally for angular2 dev. I compressed all my js into a min.js file with 1.7Mb which is working fine. Now I want to squeeze it to a gzip file with 280Kb which is much smaller. The bad part is that Chrome is downloading the file with content-type "octet-stream" instead of "application/javascript" and the Content-Encoding "gzip". Is there any simple way of making this work?
Upvotes: 0
Views: 1352
Reputation: 203286
Not very familiar with lite-server
, but since it seems to accept Express middleware you should be able to use the compression
middleware:
// lite-server-config.js
module.exports = {
...
server : {
middleware : { 1 : require('compression')() }
...
}
};
That will take care of the compression for you, so you don't have to gzip the files manually. It will also set the correct headers.
Upvotes: 3