Open matthewrobb opened 10 years ago
I believe Matt is asking about nested CSS? I would love this as well. (Also, nested pseudo-classes/elements)
there's stylus-like nesting support: https://github.com/visionmedia/css-whitespace
but not LESS-style. this is out of scope though since this module is meant to write pure CSS, and from I know, there's no plans for nesting support in CSS.
I'd say it's out of scope. There aren't any specs for it and it's often considered bad practice when trying to manage specificity on large projects. We're not aiming for feature-parity with things like Sass or Less.
It seems to have disappeared but there was a spec at some point: http://drublic.de/blog/the-css-hierarchies-module-level-3/
The spec used to live here: http://dev.w3.org/csswg/css-hierarchies/
I have no idea where this went ....
Here's some more proof lol: http://w3-org.9356.n7.nabble.com/CSS-Hierarchies-Selector-Nesting-Proposal-tt11495.html
Haha damn, that would have been awesome. It would be great if the browser implemented it. Perhaps they could have managed the specificity behind the scenes.
darn, would be happy to think about it if the spec is still being considered
wouldn't this require a change to css-parse? i think it's risky to implement these not-even-w3c-draft specs in a preprocessor that aims to align itself with a knowable css future.
yeah would be more ideal if they had been submitted and the first email thread back and forth had happened. the colors one is more critical to actually being useful, nesting not so much
It would be great if nested css is provided
@matthewrobb FWIW you could use css-whitespace (or a regular css nested variant) and pass it to myth after. It'll slow things town a bit from re-parsing but give you more or less the same result
I'll throw my hat in the ring for this feature. This alone would keep us from ditching LESS (and I'd love to).
The spec has also moved here: http://rawgithub.com/tabatkins/specs/gh-pages/css-nesting/Overview.html
oh weird, the nested {}
is ... interesting haha, I suppose that's to get the older parsers to just barf and bypass? should be simple enough to implement, looks a little gross but hey
I don't like how those spec pages show all the examples with single line nests when it seems more likely/common that people would do something like:
div {
{
p {}
}
}
yeah, blows that you need an extra level of wasteful indentation, not a huge fan of that
So we got http://tabatkins.github.io/specs/css-nesting/ but need to wait this to appears here http://dev.w3.org/csswg/ since it's a big deal. I guess this will require serious modifications of https://github.com/reworkcss/css
What about the matches-any pseudo-class? It has a similar effect and is probably easier to implement.
@ileri We will keep this issue for the nesting feature. Please open an other issue for that.
Is this something that would be considered in Myth? Maybe as a flag-only feature or something?