ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

CSSLint

by austinhappel ST2/ST3

CSSLint plugin for Sublime Text 2 and 3

Labels linting

Details

Installs

  • Total 63K
  • Win 34K
  • OS X 20K
  • Linux 9K
Aug 16 Aug 15 Aug 14 Aug 13 Aug 12 Aug 11 Aug 10 Aug 9 Aug 8 Aug 7 Aug 6 Aug 5 Aug 4 Aug 3 Aug 2 Aug 1 Jul 31 Jul 30 Jul 29 Jul 28 Jul 27 Jul 26 Jul 25 Jul 24 Jul 23 Jul 22 Jul 21 Jul 20 Jul 19 Jul 18 Jul 17 Jul 16 Jul 15 Jul 14 Jul 13 Jul 12 Jul 11 Jul 10 Jul 9 Jul 8 Jul 7 Jul 6 Jul 5 Jul 4 Jul 3 Jul 2
Windows 9 13 8 9 7 4 9 14 7 6 6 2 5 15 13 13 6 13 9 5 9 7 12 10 8 7 15 14 11 18 15 12 7 3 11 14 8 5 10 6 3 11 11 13 8 5
OS X 5 8 3 6 0 3 4 5 6 3 2 2 7 3 4 6 2 2 3 3 1 3 9 1 3 1 9 1 8 4 5 1 3 0 2 6 2 6 3 1 2 0 2 4 4 2
Linux 1 1 4 1 1 3 2 2 2 1 2 0 2 1 3 0 3 6 2 1 1 1 2 3 2 2 1 1 1 2 7 3 1 0 0 2 4 0 3 2 1 1 1 0 1 1

Readme

Source
raw.​githubusercontent.​com

CSSLint plugin for Sublime Text 2

Takes the power of csslint.net and puts it into Sublime Text. Instead of copying and pasting your CSS into the csslint.net static analysis tool, all you have to do is hit ctrl + alt + c and any warnings are displayed in your console. You can also click on those warnings in the console, and the specific line will be highlighted in your code.

You can also lint multiple files at a time by selecting them in the sidebar and selecing CSSLint Selection. A new document will open and display the lint data, sorted by filename.

Installation

  1. Copy this project folder to your Sublime Text Packages folder:

    Windows: %APPDATA%\Sublime Text 2\Packages

    Mac OS X: ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/

    Linux: ~/.config/sublime-text-2/Packages

  2. Make sure Java is installed, and that java is in your PATH.

  3. Rename the package folder from “sublime-csslint” to “CSSLint”.

Usage

  • Use the Command Pallete (Windows and Linux: Ctrl+Shift+P, OSX: Command+Shift+P) and search for:

    CSSLint: Run CSSLint

  • Use a keyboard shortcut. By default this is ctrl + alt + c. Change this by adding something like the following to your key bindings:

    { "keys": ["ctrl+alt+c"], "command": "csslint" }
    

Advanced Usage

  • Each CSS Lint rule has an ID that can be found in this file. (Look for blocks starting with CSSLint.addRule).
  • To ignore certain rules of CSS Lint, you will need to amend the Preferences > Package Settings > CSS Lint > User Preferences file. This will be blank by default. Just copy/paste the Default preferences file and then amend to suit.
  • Therefore as an example:
{
    // CSSLint rules you wish to ignore. Must be an array. Leave blank to include all default rules.
    "ignore": ["floats","universal-selector","box-model","unqualified-attributes"]
}

This would ignore messages about floats, the universal selector, box-model and unqualified attributes.

Thanks

Much of this plugin has been copied from the sublime-jslint project. I liked how that plugin worked, and based this project off of it. Much thanks to fbzhong for that!

Other Notes

This plugin uses the Rhino command-line version of CSSLint, and includes the Rhino library.