Minify HTML files using the minimize library, which uses a proper HTML parser instead of fragile regexes like other minifiers. Version 3.0.0 is the latest stable release, last updated in 2016. It requires Grunt >=0.4.0 and Node >=4. Differentiates from grunt-contrib-htmlmin by using a robust parser for more accurate minification and fewer errors.
npm install grunt-minify-htmlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to configure the Grunt task to minify an HTML file from src to dist.
Migrate to grunt-contrib-htmlmin or use a modern build tool like webpack with html-loader or html-minifier-terser.
Test minified output thoroughly, especially with complex HTML5 structures.
Ensure Node.js version is >=4 for v3. Use older versions for legacy Node.
Add grunt.loadNpmTasks('grunt-minify-html'); to your Gruntfile.Run npm install --save-dev grunt-minify-html in your project directory.
Ensure the Gruntfile exports a function that calls grunt.initConfig with the minifyHtml task config.