Skip to content

Support minify HTML files #3536

@rightaway

Description

@rightaway

Clear and concise description of the problem

Minifying html isn't built in to vite like minifying JS and CSS is. Having a htmlTerserOptions to go along with cleanCssOptions and terserOptions would be very useful since every project has to have at least one html file and there's no reason for anyone to not minify their html. It could take the options from https://github.com/terser/html-minifier-terser.

Alternative

There are plugins like https://github.com/anncwb/vite-plugin-html but they try to do too much like html-webpack-plugin. My suggestion is offer options only to minify html and nothing more, like you already offer options to minify css and js. It's a benefit having it part of vite since everyone can use it and see from the documentation that it's an option to minify built assets and a good thing to do.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions