Gridsome plugin for preparing brotli-compressed versions of assets
npm install gridsome-plugin-brotliGridsome plugin for preparing brotli-compressed versions of assets.
> Forked from gatsby-plugin-brotli
``bash`
/app.7b37c0a7.js # 246kb`
becomesbash`
/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:
`bash`
yarn add gridsome-plugin-brotli # or
npm install gridsome-plugin-brotli
gridsome.config.js`javascript`
module.exports = {
plugins: ['gridsome-plugin-brotli']
}
By default, only .css and .js files are compressed, but you can override this with the extensions option.
`javascript`
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):
`javascript`
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: gatsby build && gatsby serve`_