question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Postprocess gzip for performance

See original GitHub issue
  • Laravel Mix Version: 0.10.0
  • Node Version: 6.10.2
  • NPM Version: 3.10.10
  • OS: Ubuntu

Description:

Utilizing the gzip_static module in nginx can reduce the load on the webserver. Instead of compressing script, css and other compressibles on-the-fly for each request, these can be provided pre-compressed and nginx will just use those.

It may be possible to achieve the same behaviour in apache, but I don’t use it so I am not aware of it.

It is probably not necessary to do this in development, so it could be integrated with production flag and a optional setting in the mix config file to enable it.

I understand that mix is used on non-linux platforms so an equivalent processing step built in would be nicer since mix already has access to all the files which it has processed.

Of course, these files would have to be deleted when running npm run dev or similar commands so that will also need to be handled

Steps To Reproduce:

On linux, a single liner can achieve this behaviour as below on existing files: find public/ -name '*.js' -or -name '*.css' -or -name '*.svg' -or -name '*.eot' -or -name '*.ttf' -or -name '*.woff' -or -name '*.woff2' | xargs gzip -6 -k

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8

github_iconTop GitHub Comments

4reactions
FrenchMajestycommented, Dec 16, 2018

Following up both this issue and #619 this sounds indeed like a good feature and the justification behind them is valid. This would definitively be useful as part of Laravel Mix.

3reactions
populovcommented, Sep 13, 2017

Reason is described in #619 nginx’s gzip_static relies on pre-compressed version of file: ex. if app.js.gz exists, it serves it instead of app.js (doesn’t perform compression itself) and saves CPU and TTFB dramatically. But someone should create that .gz file. Bundler is ideal candidate for that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Postprocess gzip for performance · Issue #710 · laravel-mix ...
Description: Utilizing the gzip_static module in nginx can reduce the load on the webserver. Instead of compressing script, css and other ...
Read more >
Can gzip Compression Really Improve Web Performance?
The gzip application uses level 6 by default, favoring higher compression over speed. Nginx, on the other hand, uses level 1, favoring higher ......
Read more >
Control Your Post Processing - Netlify
Netlify does more post-processing than most hosting services. Gzipping, minifying javascript, setting content-addressable URL's etc.
Read more >
GZIP/ZLIB/Deflate Data Compression Core - Xilinx
No post processing of the compressed files is required, as the core encapsulates the com-pressed data payload with the proper headers and footers....
Read more >
How To Improve Website Performance Using gzip and Nginx ...
In this tutorial, you will configure Nginx to use gzip compression. This will reduce the size of content sent to your website's visitors...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found