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

CSSLint

by austinhappel ALL

CSSLint plugin for Sublime Text 2 and 3

Labels linting

Details

Installs

  • Total 72K
  • Win 40K
  • Mac 22K
  • Linux 10K
Apr 19 Apr 18 Apr 17 Apr 16 Apr 15 Apr 14 Apr 13 Apr 12 Apr 11 Apr 10 Apr 9 Apr 8 Apr 7 Apr 6 Apr 5 Apr 4 Apr 3 Apr 2 Apr 1 Mar 31 Mar 30 Mar 29 Mar 28 Mar 27 Mar 26 Mar 25 Mar 24 Mar 23 Mar 22 Mar 21 Mar 20 Mar 19 Mar 18 Mar 17 Mar 16 Mar 15 Mar 14 Mar 13 Mar 12 Mar 11 Mar 10 Mar 9 Mar 8 Mar 7 Mar 6 Mar 5
Windows 0 1 1 0 0 0 0 1 1 1 1 0 1 0 2 1 2 0 1 1 0 0 1 1 1 0 2 1 1 0 0 1 1 0 1 1 1 1 1 0 0 0 1 0 1 0
Mac 1 0 0 1 1 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 2
Linux 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0

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.