Skip to content

Modernize the CSS lexer#2217

Merged
jneen merged 3 commits intomasterfrom
feature.css-updates
Feb 25, 2026
Merged

Modernize the CSS lexer#2217
jneen merged 3 commits intomasterfrom
feature.css-updates

Conversation

@jneen
Copy link
Copy Markdown
Member

@jneen jneen commented Feb 17, 2026

Supersedes #2150.

  • Adds rebeccapurple to the colour list
  • Reduces the warnings from [https://bugs.ruby-lang.org/issues/21870](the warning spam bug) to one
  • Supports CSS nesting
  • Colours the contents of url(...) and url-prefix(...) as Str::Other even if they are unquoted.

TODO:

  • Automatically sync the keywords and colours here, ideally from W3 directly, and factor it out into a lazy-loaded file.
  • More explicit support for custom properties and calc()

@petamoriken
Copy link
Copy Markdown

Automatically sync the keywords and colours here, ideally from W3 directly, and factor it out into a lazy-loaded file.

While we could wait for the keywords to be automatically updated, it would be much appreciated if you could add flow and flow-root, which are used in "display multi-keyword syantax."
https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Display/Multi-keyword_syntax#using_the_multi-keyword_syntax

Comment on lines +120 to +129
/* Nested CSS with media queries */
@media (max-width: 768px) {
.container {
padding: 10px;

.header {
font-size: 1.5em;
}
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to have a test case where a media query is nested within CSS Nesting.

.container {
  padding: 10px;

  @media (width > 768px) {
    padding: 20px;
  }
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! I'll add that to the spec.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

@jneen jneen added this pull request to the merge queue Feb 25, 2026
Merged via the queue into master with commit 40f7898 Feb 25, 2026
10 checks passed
@jneen jneen deleted the feature.css-updates branch February 25, 2026 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants