Import theme error.
I'm using tailwind and to make it easier to organize my themas I've created a separate theme to make it easier to organize.
So I created a style.css
which has this content.
and my theme looks like this
nuxt is returning a warning message.

5 Replies
Hi @x0sen. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
The warning you're seeing is likely due to the way you're using the
Move your
@theme
directive and the organization of your CSS imports.
Key points from the knowledge sources:
1. The @theme
directive is a Tailwind CSS v4 feature used to define design tokens (like colors and fonts) directly in your CSS. However, it should be used in your main CSS file (e.g., assets/css/main.css
), not in a separately imported file like theme.css
. Tailwind expects the @theme
block to be present in the main entry CSS file so it can process the variables and generate the appropriate utilities and variants Nuxt UI Theme Docs.
2. Import order matters: You should import tailwindcss
first, then any UI library (like @nuxt/ui
or @nuxt/ui-pro
), and then define your @theme
block. If you split the @theme
block into a separate file and import it, Tailwind may not process it correctly, leading to warnings or ignored variables Nuxt UI Theme Docs.
Recommended structure:
Instead of splitting your theme into a separate file, define your theme variables directly in your main CSS file. For example:
If you want to use a custom font from Google Fonts, you can still use @import url(...)
at the top of your main CSS file.
Summary:Move your
@theme
block into your main CSS file (e.g., assets/css/main.css
) and avoid importing it from a separate file. This should resolve the warning and ensure Tailwind processes your theme variables correctly Nuxt UI Theme Docs.
If you need to organize your theme variables, consider using CSS custom properties in a separate file, but keep the @theme
block in the main CSS file for Tailwind to recognize it.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1192907156568150042> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
I not use NuxtUI
@kapa.ai so you mean I should import my font url directly into style.css and just call it in my theme.css file?
Let me check the knowledge base for you again. One moment! :books:
----------------------
Yes, you should import your font URL (such as from Google Fonts) directly into your main CSS file (e.g.,
style.css
or main.css
). Then, you can reference the font in your theme variables within the same file, inside the @theme
block.
The knowledge sources show that the recommended approach is to keep the @theme
block in your main CSS file, not in a separate imported file. For example:
This way, Tailwind and Nuxt will correctly process your theme variables and fonts. Avoid splitting the @theme
block into a separate file, as Tailwind expects it in the main entry CSS file Nuxt UI Theme Docs.
If you want to organize your theme variables, you can use regular CSS custom properties in a separate file, but the @theme
block itself should remain in the main CSS file for Tailwind to recognize it.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1192907156568150042> Kapa.ai is still learning and improving, please let me know how I did by reacting below.