Skip to content

fix(transformer-directives): honor the deprecated varStyle option - #5305

Closed
rajanpanth wants to merge 1 commit into
unocss:mainfrom
rajanpanth:fix/transformer-directives-varstyle
Closed

rajanpanth wants to merge 1 commit into
unocss:mainfrom
rajanpanth:fix/transformer-directives-varstyle

Conversation

@rajanpanth

Copy link
Copy Markdown
Contributor

Description

resolveApplyVariables computes applyVariable from varStyle and then overwrites it unconditionally on the very next line:

if (applyVariable === undefined) {
  if (varStyle !== undefined)
    applyVariable = varStyle ? [`${varStyle}apply`] : []
  applyVariable = ['--at-apply', '--uno-apply', '--uno']   // always wins
}

So the varStyle option has no effect at all. It is deprecated but still public and typed false | string:

varStyle: '--my-'  ->  ["--at-apply","--uno-apply","--uno"]   expected ["--my-apply"]
varStyle: false    ->  ["--at-apply","--uno-apply","--uno"]   expected []

varStyle: false is documented as the way to turn off custom-property @apply entirely, and it currently leaves all three defaults active.

Change

The default assignment moves into an else, so it only applies when varStyle is not provided. applyVariable still takes precedence over varStyle, which is the documented order.

Tests

A new apply variables block covering the defaults, varStyle as a string, varStyle: false, and applyVariable winning over varStyle. Reverting only the source and keeping the tests fails with expected [ Array(3) ] to deeply equal [ '--my-apply' ]; restored, the transformer-directives suite passes 78/78 and eslint is clean.

resolveApplyVariables computed applyVariable from varStyle and then
overwrote it unconditionally on the next line, so the option had no effect:
varStyle: false did not disable custom property apply, and a custom prefix
was ignored. The default assignment now runs only when varStyle is not
provided.
@netlify

netlify Bot commented Sep 4, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for unocss ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit a069cf4
🔍 Latest deploy log https://app.netlify.com/projects/unocss/deploys/6a9aef845b485a00084c5c43
😎 Deploy Preview https://deploy-preview-5305--unocss.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@pkg-pr-new

pkg-pr-new Bot commented Sep 4, 2026

Copy link
Copy Markdown

Open in StackBlitz

commit: a069cf4

@zyyv

zyyv commented Sep 5, 2026

Copy link
Copy Markdown
Member

This deprecated flag has been around for a long time. I plan to remove it in the next version.

@zyyv zyyv closed this in #5308 Sep 5, 2026
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

Sponsor
SponsoredKunjungi sekarang
Promo