I think the reason this debate continues to rage on is that all of the options are worse than what is currently available with pre-processors. If CSS can’t match or improve on the obvious syntax used by sass then they should not implement it. All of these options are confusing. Nesting is not a requirement for CSS. Just let it go and if you want nesting use sass.
Preprocessors aren't always available though. For example, I almost never have access to one, developing with MediaWiki (there is an extension that makes it available but most of the wiki farms I've worked for have not had it installed).
Help choose the syntax for CSS Nesting
71–80 of 170 posts
Re: Help choose the syntax for CSS Nesting
#72Earlier quoted context omitted.
I agree that it's not really worth it, but the answer is not to choose a worse option. The answer is the just not implement it. These options are bad, and CSS does not need this.
> These options are bad, and CSS does not need this. 1. You don't have to use it if it doesn't seem useful to you. 2. Many developers (me included) use Sass and other preprocessors so they can use nesting; it's probably the single most popular feature of Sass. 3. CSS doesn't need nesting but a lot of developers want it, as it improves the developer experience for writing complex selectors.
Re: Help choose the syntax for CSS Nesting
#73> Everyone wishes CSS nesting could use the same kind of simple syntax that Sass does. That’s impossible, however, because of the way browser parsing engines work. I may be in a minority, but I think that what-you-write-is-what-your-browser-parses should be ditched as a norm. There should simply be an efficient (binary) format that is treated as an irrelevant implementation detail. What is even the problem? People us…
Re: Help choose the syntax for CSS Nesting
#74I prefer Option 3, but IMHO the "&" should be required in all cases. Having it present in some places and absent in others makes the resulting code less readable, more ambiguous, and generally harder to understand. I'd rather keep things simple and uniform, even if it costs extra keystrokes. Also: it would allow things like ".a { &.b { x: y; } }" (which would be equivalent to ".a.b { x: y; }") to be clearly different…
Re: Help choose the syntax for CSS Nesting
#75> Everyone wishes CSS nesting could use the same kind of simple syntax that Sass does. That’s impossible, however, because of the way browser parsing engines work. I may be in a minority, but I think that what-you-write-is-what-your-browser-parses should be ditched as a norm. There should simply be an efficient (binary) format that is treated as an irrelevant implementation detail. What is even the problem? People us…
All of this tooling is used because of missing CSS features for the most part.
The web browser's ethos is to be a viewing and authoring environment; from Netscape Navigator on, browsers have enabled its users to write HTML and later, CSS.
For that to continue, browsers we can't have web authoring that's dependent on preprocessors, etc.
Another way to think about it: in an alternate universe where CSS had all of its current features like custom properties (a.k.a. CSS variables), nesting and most of the other modern features, there would be no Sass because we wouldn't have needed it.
In our current reality, CSS is maturing to the point where the work-arounds we implemented aren't going to needed for much longer. We can do that without breaking how the web has always worked.
Re: Help choose the syntax for CSS Nesting
#76I think the reason this debate continues to rage on is that all of the options are worse than what is currently available with pre-processors. If CSS can’t match or improve on the obvious syntax used by sass then they should not implement it. All of these options are confusing. Nesting is not a requirement for CSS. Just let it go and if you want nesting use sass.
And this is the problem. For so long there was a technical limitation because parsing complexity, then there suddenly wasn’t a limitation anymore and the existing syntax wasn’t good enough anymore so we’re shooting the moon.
I agree, all of the options are confusing. The only seemingly viable option is close to Sass, but it should just be strict and stop introducing more ambiguity to the grammar which is already absurdly complex.
Re: Help choose the syntax for CSS Nesting
#77I think the reason this debate continues to rage on is that all of the options are worse than what is currently available with pre-processors. If CSS can’t match or improve on the obvious syntax used by sass then they should not implement it. All of these options are confusing. Nesting is not a requirement for CSS. Just let it go and if you want nesting use sass.
Re: Help choose the syntax for CSS Nesting
#78Earlier quoted context omitted.
> These options are bad, and CSS does not need this. 1. You don't have to use it if it doesn't seem useful to you. 2. Many developers (me included) use Sass and other preprocessors so they can use nesting; it's probably the single most popular feature of Sass. 3. CSS doesn't need nesting but a lot of developers want it, as it improves the developer experience for writing complex selectors.
The group in 3 can use SASS. At this point you should view CSS like assembly, convenience functions go at a higher level.
CSS isn't assembly; it's higher level than that. I get why some want to treat it like a low-level language but it's not that, which is pretty obvious if developers take the time to understand CSS at a deeper level than just something a preprocessor spits out.
Also, CSS has to work in environments where using a preprocessor isn't an option—it's not just for glossy VC-backed websites. A preprocessor and all of the other tooling front-end developers use aren't an option for the vast majority of content management systems and wikis for example.
CSS still has to work in these environments.
Re: Help choose the syntax for CSS Nesting
#79Earlier quoted context omitted.
I agree that it's not really worth it, but the answer is not to choose a worse option. The answer is the just not implement it. These options are bad, and CSS does not need this.
> These options are bad, and CSS does not need this. 1. You don't have to use it if it doesn't seem useful to you. 2. Many developers (me included) use Sass and other preprocessors so they can use nesting; it's probably the single most popular feature of Sass. 3. CSS doesn't need nesting but a lot of developers want it, as it improves the developer experience for writing complex selectors.
Other people will use it and chances are you will have to deal with it sooner or later at $dayjob or whatnot.
Re: Help choose the syntax for CSS Nesting
#80I prefer Option 3, but IMHO the "&" should be required in all cases. Having it present in some places and absent in others makes the resulting code less readable, more ambiguous, and generally harder to understand. I'd rather keep things simple and uniform, even if it costs extra keystrokes. Also: it would allow things like ".a { &.b { x: y; } }" (which would be equivalent to ".a.b { x: y; }") to be clearly different…