Skip to content

kizu/csscomb.js

 
 

Repository files navigation

CSSCOMB Build Status

CSSComb is a coding style formatter for CSS.

Installation

npm install csscomb

To run csscomb, you can use the following command from the project root:

./node_modules/.bin/csscomb path[ path[...]]
./node_modules/.bin/csscomb --help

  Usage: csscomb [options] <file ...>

  Options:

    -h, --help           output usage information
    -V, --version        output the version number
    -c, --config [path]  configuration file path

Configuration

csscomb is configured using .csscomb.json file, located in the project root.

Example configuration:

{
    "exclude": ["node_modules/**"],
    "colon-space": true,
    "color-case": "lower",
    "color-shorthand": true,
    "leading-zero": false,
    "rule-indent": true,
    "block-indent": true,
    "stick-brace": true,
    "strip-spaces": true,
    "unitless-zero": true,
    "always-semicolon": true
}

Options

always-semicolon

Available value: {Boolean} true

Example: { "always-semicolon": true }

/* before */
a { color: red }

/* after */
a { color: red; }

block-indent

Available values:

  • {Boolean} true
  • {Number} of spaces
  • {String} of space characters (/[ \t]*)

Example: { "block-indent": 2 }

/* before */
  a { color: red }
  @media all { a { color: green } }

/* after */
a { color: red }
@media all {
  a { color: green }
}

colon-space

Available values:

  • {Boolean} true (means after)
  • {String}: before, after, both or any combination of whitespaces and/or a colon ( , : , \t:\n\t etc.)

Example: { "colon-space": true }

/* before */
a { color:red }

/* after */
a { color: red }

Example: { "colon-space": ":\n\t\t" }

/* before */
a {
  color: red;
}

/* after */
a {
  color:
    red;
}

Example: { "colon-space": ":" }

/* before */
a { color: red }

/* after */
a { color:red }

Tests

Run npm test for tests.

Contributing

Anyone and everyone is welcome to contribute. Please take a moment to review the guidelines for contributing.

Authors

@mishanga

Thanks for assistance and contributions:

@miripiruni, @puzankov, @L0stSoul

License

This software is released under the terms of the MIT license.

Other projects

About

CSS coding style formatter

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • JavaScript 87.0%
  • CSS 13.0%