node package manager
Loosely couple your services. Use Orgs to version and reuse your code. Create a free org »

grunt-scsslint

grunt-scsslint

Linting your scss with scsslint

Getting Started

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-scsslint --save-dev

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

grunt.loadNpmTasks('grunt-scsslint');

The "scsslint" task

Overview

This task requires you to have Ruby and scss-lint installed. If you're on OS X or Linux you probably already have Ruby installed; test with ruby -v in your terminal. When you've confirmed you have Ruby installed, run gem install scss-lint to install scss-lint.

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

grunt.initConfig({
  scsslint: {
    options: {
      // Options go here. 
    },
    your_target: {
      // Target-specific file lists and/or options go here. 
    },
  },
})

Options

config

Type: String

Path to the Yaml config file. See scss-lint#configuration

exclude

Type. String

Allows you to specify a glob pattern of files that should not be linted .

excludeLinter

Type. String|Array

Specify which linters you don't want to run. A list of linters can be found here

includeLinter

Type. String|Array

Specify which linters you want to run. A list of linters can be found here

bundleExec

Type: Boolean Default: false

Run scss-lint with bundle exec: bundle exec scss-lint.

Usage Examples

Example config

grunt.initConfig({
  scsslint: {
    dist: {
      src: ['./app/style/main.scss'],
    }
  },
});
 
grunt.loadNpmTasks('grunt-scsslint');
 
grunt.registerTask('default', ['scsslint']);

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

  • 0.1.0 Rewrite. Using scsslint. Moved tests there.
  • 0.0.8 Fixed bug introdruced in 0.0.7 where not all files where processed.
  • 0.0.7 ignore folders
  • 0.0.6 Added more tests
  • 0.0.5 Rewrote sass-lint handeling. Added simple tests.
  • 0.0.4 fix but where includeLinter|excludeLinter where not working correctly
  • 0.0.3 remove unnecessary newline in gruntlog
  • 0.0.2 add bundler support
  • 0.0.1 First Release

License

Copyright (c) 2014 Fabrice Weinberg. Licensed under the MIT license.