grunt-contrib-csslint

raw JSON →
2.0.0 verified Fri May 01 auth: no javascript deprecated

Grunt plugin to lint CSS files using CSSLint. Version 2.0.0 is the latest stable release, compatible with Node.js >=0.10.0. This plugin integrates CSSLint into Grunt, allowing configuration of CSSLint rules directly in the Gruntfile. It supports custom rule sets and reports warnings and errors. Compared to other CSS linters, it leverages the CSSLint library and is designed for Grunt-based workflows. It has been maintained as part of the grunt-contrib series, but note that CSSLint itself is no longer actively maintained.

error Warning: Task "csslint" not found.
cause Missing grunt.loadNpmTasks('grunt-contrib-csslint') line.
fix
Add grunt.loadNpmTasks('grunt-contrib-csslint'); to your Gruntfile.
deprecated CSSLint is no longer actively maintained. Consider using stylelint instead.
fix Migrate to stylelint or another maintained CSS linter.
npm install grunt-contrib-csslint
yarn add grunt-contrib-csslint
pnpm add grunt-contrib-csslint

Install plugin, configure CSSLint rules, and run the csslint task.

npm install grunt-contrib-csslint --save-dev
// Gruntfile.js
module.exports = function(grunt) {
  grunt.initConfig({
    csslint: {
      options: {
        'adjoining-classes': false,
        'box-sizing': false
      },
      src: ['public/css/*.css']
    }
  });
  grunt.loadNpmTasks('grunt-contrib-csslint');
  grunt.registerTask('default', ['csslint']);
};