Indent-based CSS syntax for PostCSS
Indent-based CSS syntax for PostCSS.
It was designed to be used with PreCSS and postcss-nested-props.
But you can use it with any PostCSS plugins
or use it without any PostCSS plugins.
With gulp-sass-to-postcss-mixins you can use
+mixin syntax as in Sass.
SugarSS MIME-type is
.sss file extension.
We recommend 2 spaces indent. However, SugarSS autodetects indent and can be used with tabs or spaces.
But it is prohibited to mix spaces and tabs in SugarSS sources.
SugarSS was designed to have intuitively multiline selectors and declaration values.
There are 3 rules for any types of nodes:
// 1. New line inside brackets will be ignored@(// 2. Comma at the end of the line@(// 3. Backslash before new line@(
In selector you can put a new line anywhere. Just keep same indent for every line of selector:
In declaration value you can put new line anywhere. Just keep bigger indent for value:
SugarSS supports two types of comments:
/*Multiline comments*/// Inline comments
There is no “silent” comments in SugarSS. Output CSS will contain all comments
.sss source. But you can use postcss-discard-comments
for Sass’s silent/loud comments behaviour.
SugarSS separates selectors and declarations by
So you must write a space after property name:
color: black is good,
color:black is prohibited.
We are working on syntax highlight support in text editors.
Right now, you can set
Stylus syntax highlight for
Install SugarSS via npm:
npm install sugarss --save-dev
Just set SugarSS to PostCSS
parser option and PostCSS will compile
SugarSS to CSS.
var sugarss = ;var postcss = ;var rename = ;gulp;
module:loaders:test: /\.sss/loader: "style-loader!css-loader!postcss-loader?parser=sugarss"
postcss -u autoprefixer -p sugarss test.sss -o test.css
Sometimes we use PostCSS not to build CSS, but to fix source file. For example, to sort properties by postcss-sorting.
For this cases, use
syntax option, instead of
You can even compile existed CSS sources to SugarSS syntax.
stringifier option instead of
Cute project logo was made by Maria Keller.