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

@apply classes will not update when config updated #826

Closed
kaiser-9527 opened this issue Apr 13, 2022 · 3 comments · Fixed by #1163
Closed

@apply classes will not update when config updated #826

kaiser-9527 opened this issue Apr 13, 2022 · 3 comments · Fixed by #1163

Comments

@kaiser-9527
Copy link

// unicss.config.ts

{
    theme: {
        colors: {
            primary: '#333333'
        }
    }
}

// components

.title {
    @apply text-primary;
}

when i update the primary color to #666666, the title text color is still #333333

@TrickyPi
Copy link
Contributor

TrickyPi commented Jun 5, 2022

I don't run into this issue when i config the theme in vite.config.ts.
It's my vite.config.ts

import { defineConfig } from 'vite'
import Unocss from 'unocss/vite'
import react from '@vitejs/plugin-react'
import tsconfigPaths from 'vite-tsconfig-paths'
import transformerDirectives from '@unocss/transformer-directives'
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    react(),
    Unocss({
      transformers: [transformerDirectives()],
      theme: {
        colors: {
          primary: '#333333'
        }
      }
    }),
    tsconfigPaths(),
  ],
})

I guess the problem is that the change of uno.config.js didn't active vite/(other build tools) recompile, but i think it's more appropriate to config theme in vite.config.ts if you need live updates when the theme is updated.

@antfu
Copy link
Member

antfu commented Jun 5, 2022

Should be fixed

@antfu antfu closed this as completed Jun 5, 2022
@TrickyPi
Copy link
Contributor

TrickyPi commented Jun 6, 2022

This #837 PR was reverted in #917, are there any commits that have resolved this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants