Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

vincent15000's avatar

How can I use a Brotli compressed JS file ?

Hello,

I just tried to use laravel-mix-compress, I have added mix.compress() in the webpack file and I get 2 more files for each JS : *.js.gz and *.js.br in the public directory.

How can I use the compressed file instead of the normal JS file ?

I have search on the web, I have found sveral tools to minify, to compress, ... but no example to include the compressed file inside the head.

I have tried this but it doesn't work.

<script src="{{ mix('js/app.js.br') }}"></script>
...
<script src="js/app.js.br"></script>

Sure I have to decompress the file or find some way to import the compressed file, but I really don't know how to do.

Any idea ?

Thank you ;).

V

0 likes
0 replies

Please or to participate in this conversation.