-
Notifications
You must be signed in to change notification settings - Fork 590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CSS] Relaxed Nesting Support #3898
Conversation
This commit implements relaxed syntax for nested style rules according to https://www.w3.org/TR/css-nesting-1/#nested-style-rule. In general it means, nested selectors of nested style rules no longer need to start with `&` operator to denote html tags. The implementation adopts `properties-or-selectors` context from Less syntax to achieve reliable distinction between declarations and selectors without loosing support for interpolation.
This commit renames `style-block` contexts to `stylesheet-block` in order to avoid confusion with official syntax specs, because a `style-block` is actually what is represented by `property-lists` contexts in this syntax definition. A stylesheet block's content is however equal to top-level content, which does not support declarations (property-value pairs).
It appears SCSS and Less are becoming obsolete. |
Note that lazy nesting is supported by all major browsers. |
Thanks, appreciate the work on this. |
Thanks for reviewing. |
As of ST4149 `&` is part of selector_start in CSS and doesn't need to be explicitly added by Less. Variable `selector_begin` is maintained only for backward compatibility with some unreleased revisions of core CSS. Variable `property_or_selector_begin` as adjusted to match CSS (as of sublimehq/Packages#3898) and is maintained for backward compatibility with ST builds which do not ship that PR.
How is this fix distributed - does it come bundled in a mainstream Sublime build, or will this be published independently to the Sublime package registry sooner than that? |
Yes, eventually.
No, but you can get it early with the README instructions, or I think jfcherng has a script to get the latest |
Resolves #3897
This commit implements relaxed syntax for nested style rules according to https://www.w3.org/TR/css-nesting-1/#nested-style-rule.
In general it means, nested selectors of nested style rules no longer need to start with
&
operator to denote html tags.The implementation adopts
properties-or-selectors
context from Less syntax to achieve reliable distinction between declarations and selectors without loosing support for interpolation.