NOTE: This fork only adds support for Laravel Mix 6.x and above by tweaking its package.json. It is not published to npm and must be imported via direct github link, as shown here:
// package.json
{
"devDependencies": {
"laravel-mix-brotli": "github:dvicklund/laravel-mix-brotli"
}
}
or,
npm i -D https://github.com/dvicklund/laravel-mix-brotli
A wrapper around brotli-webpack-plugin for Laravel Mix.
let mix = require('laravel-mix');
require('laravel-mix-brotli');
// ...
mix.js('resources/js/app.js', 'public/js')
.sass('resources/sass/app.scss', 'public/css')
.brotli();
Before you get started, make sure you're using laravel-mix
version 6 or higher.
You can install the package with yarn or npm:
yarn add laravel-mix-brotli
npm install laravel-mix-brotli
Then install the extension by requiring the module in your Mix configuration.
let mix = require('laravel-mix');
require('laravel-mix-brotli');
// ...
brotli can then be enabled by calling .brotli()
in your Mix chain.
mix.js('resources/js/app.js', 'public/js')
.sass('resources/sass/app.scss', 'public/css')
.brotli();
Custom options can be passed when calling brotli if necessary.
mix.js('resources/js/app.js', 'public/js')
.sass('resources/sass/app.scss', 'public/css')
.brotli({
enabled: mix.inProduction(),
asset: '[path].br[query]',
test: /\.(js|css|html|svg)$/,
threshold: 10240,
minRatio: 0.8
});
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.