Community Plugin
View plugin on GitHubgatsby-plugin-minify
A Gatsby plugin to easily minify all output HTML files.
Installation
$ npm install gatsby-plugin-minify
# or yarn
$ yarn add gatsby-plugin-minify
Usage
Include the plugin in your gatsby-config.js
file.
module.exports = {
plugins: [`gatsby-plugin-minify`]
}
options
If you need to pass options to html-minifier-terser use the plugins options, see html-minifier-terser docs for all available options.
// in gatsby-config.js
module.exports = {
plugins: [
{
resolve: `gatsby-plugin-minify`,
options: {
removeAttributeQuotes: true
// ...
}
}
]
}
default options:
const defaultOptions = {
collapseWhitespace: true,
minifyCSS: true,
minifyJS: true,
removeComments: true,
removeEmptyAttributes: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true,
processConditionalComments: true
}
Contributing
- Fork it on GitHub!
- Clone the fork to your own machine.
- Checkout your feature branch:
git checkout -b my-awesome-feature
- Commit your changes to your own branch:
git commit -am 'Add some feature'
- Push your work back up to your fork:
git push -u origin my-awesome-feature
- Submit a Pull Request so that we can review your changes.
NOTE: Be sure to merge the latest from “upstream” before making a pull request!