Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(directives): theme() breaks @apply #1025

Merged
merged 2 commits into from May 29, 2022
Merged

Conversation

Dunqing
Copy link
Member

@Dunqing Dunqing commented May 29, 2022

fix: #1021

@netlify
Copy link

netlify bot commented May 29, 2022

Deploy Preview for unocss canceled.

Built without sensitive environment variables

Name Link
🔨 Latest commit 654e380
🔍 Latest deploy log https://app.netlify.com/sites/unocss/deploys/62938ae56f6d0a0008651643

@antfu antfu merged commit d04ff70 into unocss:main May 29, 2022
@Dunqing
Copy link
Member Author

Dunqing commented May 29, 2022

css-tree cannot parse Function in css variables, so theme() does not work.

Do we need to support it?

@antfu cc

@hannoeru
Copy link
Collaborator

@Dunqing you can get raw data then throw it back to css-tree parser to parse that part as Function.

@antfu
Copy link
Member

antfu commented May 29, 2022

We could just do a simple regex replace instead of relying on the parse result.

@ameinhardt
Copy link

also, there's parseCustomProperty

const ast = parse(originalCode || code.original, {
  parseAtrulePrelude: false,
  positions: true,
  parseCustomProperty: true,
  filename,
})

Wouldn't that work?

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.

theme() breaks @apply
4 participants