akselsson / grunt-unused-css-check

Checks css and html files for missing classes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

grunt-css-check

Checks css and html files for missing classes

Getting Started

This plugin requires Grunt ~0.4.5

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-unused-css-check --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-unused-css-check');

The "unused_css_check" task

Overview

In your project's Gruntfile, add a section named unused_css_check to the data object passed into grunt.initConfig().

grunt.initConfig({
  unused_css_check: {
    options: {
        checkCss: true, //Check css-files for classes that do not exist in html
        checkHtml: true, // Check html-files for classes that do not exist in css
        ignore: [] //List of class name patterns to ignore (string or regexp)
    },
    your_target: {
        files: {
            css: ['path to css files'],
            html: ['path to html files'],
            js: ['path to javascript files (optional)'],
        }
    },
  },
});

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

(Nothing yet)

About

Checks css and html files for missing classes

License:MIT License


Languages

Language:JavaScript 100.0%