4 ms·
A lot of folks here are saying that they couldn't live without nesting CSS selectors. FYI the CSS Working Group approved a working draft of native CSS Nesting
by dfabulich 8y ago
A lot of folks here are saying that they couldn't live without nesting CSS selectors.
FYI the CSS Working Group approved a working draft of native CSS Nesting last month; it's in "stage 1."
https://drafts.csswg.org/css-nesting-1/ https://drafts.csswg.org/css-nesting-1/
There's a PostCSS polyfill you can use for it today. https://github.com/jonathantneal/postcss-nesting https://github.com/jonathantneal/postcss-nesting
- stefanfisk 8y agowhen I use sass nesting it's almost always to do BEM style selectors via `&-`, which really is soo much easier to read than having to type the full selector every time, especially when you have A LOT of components in a directory structure. sadly this use case seems to be missing from the coming spec :(
- somefuckingguy 8y agoAgreed. This is trivial to add if you use postcss (postcss-nested)
- type0 8y agoCorrect me if i'm wrong but postcss is js or node.js only, where's sass is trivial to add with any language.
- MarvelousWololo 8y agoI'm not totally sure but I think that for Sass only you'd still need Ruby or Node.
- serial_dev 8y agoSass has LibSass which is a C++ port of the Sass engine (which was originally written in Ruby). There are wrappers available in many languages, such as Go, Java, Node, PHP (and even Ruby, interestingly enough). https://sass-lang.com/libsass https://sass-lang.com/libsass
- dfabulich 8y agohttps://github.com/w3c/csswg-drafts/issues/2701#issuecomment-395504004 https://github.com/w3c/csswg-drafts/issues/2701#issuecomment... > Yeah, very intentionally not allowed. It causes parsing issues, for one (you can't arbitrarily split up an ident and be guaranteed that both halves are still idents), and it's grammatically ambiguous with tagname selectors. There's an open issue https://github.com/w3c/csswg-drafts/issues/3748 https://github.com/w3c/csswg-drafts/issues/3748 "add note explaining that BEM `&__element` class accumulation isn't supported and why"
- h1d 8y agoPreprocessors like Stylus has all you want and in a better way (ex : variable declaration). I already have something better than CSS in 5 years when most browsers in the market get the newer CSS, so I don't see a point in following CSS now. Better to spend time making the preprocessor more accessible to developers.