question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I 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:

  1. postcss-nested to unpack nested rules and support & in selector.
  2. 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:closed
  • Created 9 years ago
  • Comments:40 (33 by maintainers)

github_iconTop GitHub Comments

1reaction
MoOxcommented, Sep 21, 2014

; 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 :/=

0reactions
aicommented, Feb 1, 2015

Mixins plugin is ready too: https://github.com/postcss/postcss-mixins

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found