Gatsby Book Launch

“The missing guide to the modern web” launches on Thursday, Sep 29th: Modular: The Web’s New Architecture

ContactSign Up for Free
Community Plugin
View plugin on GitHub

gatsby-plugin-html-minifier

A Gatsby plugin to easily minify HTML file

Installation

With npm:

npm install --save gatsby-plugin-html-minifier html-minifier

Or with Yarn:

yarn add gatsby-plugin-html-minifier html-minifier

Usage

In your gatsby-config.js file, load in the plugin along with an object of any <html> attributes you want to add. Example:

module.exports = {
    plugins: [
        {
            resolve: 'gatsby-plugin-html-minifier',
            options: {
                caseSensitive: false,
                collapseBooleanAttributes: false,
                useShortDoctype: false
            }
        }
    ]
};
© 2022 Gatsby, Inc.