Last active
August 29, 2015 14:06
-
-
Save MoOx/28808ebe3a9e4bd897ef to your computer and use it in GitHub Desktop.
postcss-custom-properties test for full support. Is this correct ?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:root, | |
.light { | |
--color: black; | |
} | |
.dark, | |
.light--inverted { | |
--color: white; | |
} | |
p { | |
background: var(--color); | |
} | |
a, | |
.link { | |
color: var(--color); | |
} | |
#important { | |
--color: red | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
p, | |
.light p, | |
p.light {background: black;} | |
.dark p, | |
p.dark, | |
.light--inverted p, | |
p.light--inverted {background: white;} | |
#important p, | |
p#important {background: red;} | |
a, | |
.light a, | |
a.light, | |
.link, | |
.light .link, | |
.link.light {color: black;} | |
.dark a, | |
a.dark, | |
.light--inverted a, | |
a.light--inverted, | |
.dark .link, | |
.link.dark, | |
.light--inverted .link, | |
.link.light--inverted {color: white;} | |
#important a, | |
a#important, | |
#important .link, | |
.link#important {color: red;} |
Example adjusted to remove p .light
like selectors. I was a bug related to \n converted to space & shablahblah...
I need to work on the reverse cascade by adding a prepended selectors on generated selector that have custom prop defined after. eg: for .light
in .dark
, I "just need" to generate something like this
/* normal generation */
p,
.light p,
p.light,
/* + reverse cascade for .dark */
.dark .light p,
.dark p.light
{background: black;}
Each time we got a redefined custom prop, we need to add prefixed values for values defined before in case of this use case. Should be enough.
Here I think I got something http://jsbin.com/hunuy/2/edit
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've an idea about generating a reverse cascade to handle nesting of selector.
This will make pretty freaking huge selectors, but this might work "as expected" (lol).