Syntax like Sass
See original GitHub issueI hate ;
in any computer language and hate CSS custom properties syntax.
But PostCSS 3 in Safe mode will support rules inside rules:
a {
b {}
}
decls in root:
one: 1;
two: 2;
a {}
any decls without ;
:
a {
color: white
width: 10px
}
With this features we can create Sass like syntax:
$blue: #00f
$width: 100px
a {
color: $blue
width: $width
&:hover {
width: calc($width - 10px)
}
}
So we need two plugins:
postcss-nested
to unpack nested rules and support&
in selector.postcss-simple-vars
to find$\w+
decls, save they value, remove them and then find$\w+
in values and insert saved values there (postcss-calc
we have already).
Issue Analytics
- State:
- Created 9 years ago
- Comments:40 (33 by maintainers)
Top Results From Across the Web
Syntax - Sass
The SCSS syntax uses the file extension .scss . With a few small exceptions, it's a superset of CSS, which means essentially all...
Read more >Sass - Syntax - Tutorialspoint
The SCSS (Sassy CSS) is an extension of CSS syntax. This means every valid CSS is a valid SCSS as well. SCSS makes...
Read more >Alternate Sass Syntax
Sass has two syntaxes. The most commonly used syntax is known as “SCSS” (for “Sassy CSS”), and is a superset of CSS3's syntax....
Read more >6 - Sass-like Syntax Without Sass - PostCSS Tutorials - YouTube
Here we show you how you can use a sass - like syntax in your CSS.https://www.patreon.com/leveluptutsThe best shared web ...
Read more >How '@use' like '@import' (Sass new syntax)
For me and a lot of people who been using Sass, one of the biggest advantages of this CSS preprocessor, is that syntax...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
; are required in scss, which is different from old sass syntax (indented syntax).
I think postcss should parse only valid css & should not add things like this in the parser.
For old sass like syntax, css-whitespace does the job correctly and can be used with postcss-import.
If custom prop syntax is like it is, its because some people have thinks about it for hours. Custom prop are way more powerful than simple vars. Postcss-custom-properties with full custom prop support (v1.0) is coming soon (hopefully this week) & you will see its completely different than “stupid” vars.
So -1 for this 2 things :/=
Mixins plugin is ready too: https://github.com/postcss/postcss-mixins