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 59K
  • Win 31K
  • OS X 19K
  • Linux 8K
Dec 14 Dec 13 Dec 12 Dec 11 Dec 10 Dec 9 Dec 8 Dec 7 Dec 6 Dec 5 Dec 4 Dec 3 Dec 2 Dec 1 Nov 30 Nov 29 Nov 28 Nov 27 Nov 26 Nov 25 Nov 24 Nov 23 Nov 22 Nov 21 Nov 20 Nov 19 Nov 18 Nov 17 Nov 16 Nov 15 Nov 14 Nov 13 Nov 12 Nov 11 Nov 10 Nov 9 Nov 8 Nov 7 Nov 6 Nov 5 Nov 4 Nov 3 Nov 2 Nov 1 Oct 31 Oct 30
Windows 14 14 15 16 8 4 17 26 11 22 19 8 10 21 19 13 9 15 5 5 20 27 13 21 14 9 11 12 20 24 15 19 11 7 17 20 16 17 23 9 11 19 17 14 24 15
OS X 3 6 5 2 4 4 2 7 10 7 3 2 7 5 6 7 6 2 5 4 5 6 7 9 6 6 5 7 9 6 10 2 4 4 5 10 6 13 8 1 3 7 7 7 9 5
Linux 0 4 3 3 2 1 3 1 6 4 2 0 2 7 4 5 4 1 0 1 4 4 0 3 6 1 4 2 5 5 3 4 1 1 5 2 1 4 0 3 2 2 4 0 3 2

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.