Remove unused css classes in your html.
npm install grunt-unclassify

> Remove unused css classes in your html.
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:
``shell`
npm install grunt-unclassify --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
`js`
grunt.loadNpmTasks('grunt-unclassify');
to the data object passed into grunt.initConfig().`js
grunt.initConfig({
unclassify: {
options: {
// Task-specific options go here.
},
your_target: {
// Target-specific file lists and/or options go here.
},
},
})
`NOTE: This plugin uses Cheerio to parse your HTML. Besides removing classes, it may also attempt to fix unclosed/stray tags and other formatting issues.
$3
#### options.stylesheets
Type:
Array/PathAn array of paths to stylesheets. You can use file globbing patterns. Valid examples:
['path/to/styles.css'] OR ['path/to/*/.css'] #### options.customClasses
Type:
Array/String
Default value: []Array or space-separated list of additional classes to protect (not remove from html).
#### options.jsClasses
Type:
Array/Boolean
Default value: trueArray of prefixes to protect (not remove). Default of
true will result in ['js-']. Setting to false will disable it. Use this to preserve classes that are only used by your javascript (and are not in the css).#### options.bootstrapClasses
Type:
Array/Boolean
Default value: falseArray of bootstrap javascript classes to protect (not remove). Setting to
true will result in a default list maintained by this plugin. Last updated for Bootstrap v3.3.1.#### options.foundationClasses
Type:
Array/Boolean
Default value: falseArray of foundation javascript classes to protect (not remove). Setting to
true will result in a default list maintained by this plugin. Last updated for Foundation 5.#### options.html5bpClasses
Type:
Array/Boolean
Default value: falseArray of HTML5 Boilerplate classes to protect (not remove). Setting to
true will result in a default list maintained by this plugin. Last updated for HTML5BP v4.3.0.#### options.filter
Type:
FunctionFunction to protect classes. Classes that were not found in the css will run through this function. Return
true to keep the class, false to remove the class. Parameters provided (className, classes).#### options.knockout
Type:
Boolean
Default value: falseDetermines whether to search