If you want to just clean files, Command Line Tool is easy way.
Simple and safety HTML/SVG cleaner to minify without changing its structure.
See htmlclean for options and more information about htmlclean.
This plugin requires Grunt
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-htmlclean --save-dev
In your project's Gruntfile, add a section named
htmlclean to the data object passed into
See htmlclean for the options.
Working with grunt-task-helper
For example, you want to clean only changed HTML files. Then grunt-task-helper helps it. In this case, using
handlerByContent Function instead of this plugin is better. Because grunt parses
files components in every tasks(targets).
handlerByContent can be included to one task with other handlers (e.g. select changed HTML files).