This plugin has been deprecated in favour of https://github.com/agaengel/gridsome-plugin-precompress, and will receive no further updates.
Gridsome plugin for preparing brotli-compressed versions of assets.
Forked from gatsby-plugin-brotli
/app.7b37c0a7.js # 246kb
becomes
/app.7b37c0a7.js.br # 67kb
This plugin will only generate the compressed files. To see them been served to the client, your Gridsome website should run on a production server that supports Brotli (.br
) files. The Gridsome development server does not serve the compressed versions.
With npm:
yarn add gridsome-plugin-brotli # or
npm install gridsome-plugin-brotli
gridsome.config.js
module.exports = {
plugins: ['gridsome-plugin-brotli']
}
By default, only .css
and .js
files are compressed, but you can override this with the extensions
option.
module.exports = {
plugins: [
{
use: 'gridsome-plugin-brotli',
options: {
extensions: ['css', 'html', 'js', 'svg', 'json']
}
}
]
}
You can even place all the brotli-compressed files (only the brotli ones, the uncompressed ones will
be saved in the dist
directory as usual) in a dedicated directory (ex. dist/brotli
):
module.exports = {
plugins: [
{
use: 'gridsome-plugin-brotli',
options: {
path: 'brotli'
}
}
]
}
Licensed under MIT.
NOTE: This plugin only generates output when run in production
mode! To test, run: gridsome build
and view the dist
folder.