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

Add app.css alias for Tailwind CSS v4 add-on #515

Open
hyunbinseo opened this issue Mar 30, 2025 · 0 comments
Open

Add app.css alias for Tailwind CSS v4 add-on #515

hyunbinseo opened this issue Mar 30, 2025 · 0 comments
Labels
enhancement New feature or request pkg:add sv add

Comments

@hyunbinseo
Copy link
Contributor

There is a heated discussion related to using the @apply directive in a Svelte component:

Without the @reference directive, the following error occurs:

[plugin:@tailwindcss/vite:generate:serve]
Error: Cannot apply unknown utility class: text-red-700

I personally believe this is the best workaround:

// svelte.config.js
const config = {
  kit: {
    // ...
    alias: { '$app.css': './src/app.css' },
  },
};

export default config;
<style>
  @reference "$app.css";
  a {
    @apply text-red-700;
  }
</style>

The ./src/app.css will be hard-coded to the Prettier config file as well, so I guess it can be safely aliased.

Note

I do understand that this is only needed for people using the @apply directive, but this seemed to be the desirable place to leave this content.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request pkg:add sv add
Projects
None yet
Development

No branches or pull requests

2 participants