[1.x] fix(theme): return Less_Tree_Keyword for boolean custom Less functions#4405
Merged
[1.x] fix(theme): return Less_Tree_Keyword for boolean custom Less functions#4405
Conversation
Boolean return values from `addCustomLessFunction` were wrapped in
`Less_Tree_Quoted`, producing a quoted string ('true'/'false') instead
of a Less keyword (true/false). Quoted strings do not match in mixin
guards, making it impossible to use boolean-returning functions with
`.mixin(false) {}` patterns.
Switch to `Less_Tree_Keyword` so booleans behave as proper Less keywords.
CSS custom property output is unchanged; only mixin guard matching is fixed.
Fixes #4383
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Fixes #4383.
Problem
addCustomLessFunctionwrapped boolean return values inLess_Tree_Quoted('', 'true'/'false'), producing a quoted string in Less. Less's built-in boolean keywords (true/false) areLess_Tree_Keyword, not quoted strings. This meant boolean-returning custom functions could not be used in mixin guards:Fix
Use
Less_Tree_Keywordinstead ofLess_Tree_Quotedfor boolean return values. CSS custom property output is unchanged (falserenders asfalsein both cases); only mixin guard matching is fixed.Test
Extended the existing
theme_extender_can_add_custom_functiontest with a mixin guard that must matchfalse— asserting that.dummy_func_test3{color:red}appears in the compiled CSS.