You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
@container ruleset spaces removed after container-name #4397
Hi @cmerighi! I'm Dosu and I’m helping the less.js team.
This is a known issue in Less 4.4.1: when you use a variable for the container name in an @container rule, Less doesn't automatically preserve the space between the name and the condition. This happens because of how the parser merges nodes and sets a noSpacing flag, causing the output to omit the space—so @container foo(min-width: 1024px) is generated instead of the expected @container foo (min-width: 1024px)details.
This was a regression and has been fixed in Less 4.4.2 (PR #4363). Upgrading to 4.4.2 or later should resolve the issue and preserve the space as expected.
If you can't upgrade, your workaround of adding a trailing space to the variable value (e.g., @varxs: ~"@{varx} ";) is the correct approach for Less 4.4.1 source.
The space-removal issue with @container rules was fixed in Less 4.4.2, and there’s no evidence of a regression in 4.5.1—the fix should still be effective in your current version link. If you’re still seeing the problem, double-check that your variable includes any needed trailing space, since Less relies on the actual value for spacing. If the issue persists despite this, let me know and I can help troubleshoot further.
changed the title [-]@container ruleset spaces removed after container-name.[/-][+]@container ruleset spaces removed after container-name[/+]on Jan 21, 2026
Activity
dosubot commentedon Jan 21, 2026
Hi @cmerighi! I'm Dosu and I’m helping the less.js team.
This is a known issue in Less 4.4.1: when you use a variable for the container name in an @container rule, Less doesn't automatically preserve the space between the name and the condition. This happens because of how the parser merges nodes and sets a noSpacing flag, causing the output to omit the space—so
@container foo(min-width: 1024px)is generated instead of the expected@container foo (min-width: 1024px)details.This was a regression and has been fixed in Less 4.4.2 (PR #4363). Upgrading to 4.4.2 or later should resolve the issue and preserve the space as expected.
If you can't upgrade, your workaround of adding a trailing space to the variable value (e.g.,
@varxs: ~"@{varx} ";) is the correct approach for Less 4.4.1 source.To reply, just mention @dosu.
Share context across your team and agents. Try Dosu.
cmerighi commentedon Jan 21, 2026
@dosu 4.4.1 is the first version from which I experience the issue. I'm now on version 4.5.1.
dosubot commentedon Jan 21, 2026
The space-removal issue with @container rules was fixed in Less 4.4.2, and there’s no evidence of a regression in 4.5.1—the fix should still be effective in your current version link. If you’re still seeing the problem, double-check that your variable includes any needed trailing space, since Less relies on the actual value for spacing. If the issue persists despite this, let me know and I can help troubleshoot further.
To reply, just mention @dosu.
Share context across your team and agents. Try Dosu.
[-]@container ruleset spaces removed after container-name.[/-][+]@container ruleset spaces removed after container-name[/+]puckowski commentedon Jan 23, 2026
Hello,
I believe I have a change that would make this syntax possible
but I need some time to simplify and review the solution. I'll try to create a PR this weekend.
fix:issue#4397 container variable
fix:(issue#4397): container query variable names
puckowski commentedon Jan 25, 2026
I proposed a fix for this issue in #4398 which is pending peer review.
Less 5 alpha.1: Jess-powered compiler preview (#19)
Less 5 alpha.1: Jess-powered compiler preview (#4487)