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

In version 0.47.1, @forward or @use syntax in scss, causing unocss invalid #1929

Closed
lainbo opened this issue Nov 29, 2022 · 2 comments · Fixed by #1930
Closed

In version 0.47.1, @forward or @use syntax in scss, causing unocss invalid #1929

lainbo opened this issue Nov 29, 2022 · 2 comments · Fixed by #1930

Comments

@lainbo
Copy link

lainbo commented Nov 29, 2022

In version 0.47.1, .scss files use @forward or @use to import other scss files, and @apply in imported files is invalid

// main.ts
import index.scss
// index.scss
@forward './a.scss';

.foo {
  // this @apply is work
  @apply bg-red-500;
}
// a.scss
.bar {
  // this @apply is invalid
  @apply bg-red-600 text-white;
}
@sibbng
Copy link
Member

sibbng commented Nov 29, 2022

Probably because of #1923

Could you try with that:

 transformers: [
    transformerDirectives({ enforce: 'default' }),
  ],

If you are using Nuxt you may need to disable cssnano's mergeRules optimization as shown here.

@lainbo
Copy link
Author

lainbo commented Nov 29, 2022

Probably because of #1923

Could you try with that:

 transformers: [
    transformerDirectives({ enforce: 'default' }),
  ],

If you are using Nuxt you may need to disable cssnano's mergeRules optimization as shown here.

Oh thanks. It's working! But I'm not sure that's the best solution.

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 a pull request may close this issue.

2 participants