feat: add support for @function at-rule#168
Merged
bartveneman merged 3 commits intomainfrom Mar 10, 2026
Merged
Conversation
Parses the CSS @function at-rule (https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@function). The @function body is treated as a conditional block (like @media), allowing both declarations and nested at-rules such as @media inside the function body. The prelude is parsed to extract the function name as an IDENTIFIER node. Usage: const ast = parse('@function --transparent(--color, --alpha) { result: oklch(...); }') const fn = ast.first_child fn.name // 'function' fn.value // '--transparent(--color, --alpha)' (raw prelude) fn.prelude.first_child.text // '--transparent' (function name as IDENTIFIER) fn.block.children // [DECLARATION result: ...] Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #168 +/- ##
==========================================
+ Coverage 94.96% 94.97% +0.01%
==========================================
Files 16 16
Lines 2877 2887 +10
Branches 804 807 +3
==========================================
+ Hits 2732 2742 +10
Misses 145 145 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Bundle ReportChanges will increase total bundle size by 423 bytes (0.27%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: @projectwallace/css-parser-esmAssets Changed:
Files in
Files in
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Parses the CSS
@functionat-rule (https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@function).The
@functionbody is treated as a conditional block (like@media), allowing both declarations and nested at-rules such as@mediainside the function body. The prelude is parsed to extract the function name as anIDENTIFIERnode.Usage: