Skip to content
This repository has been archived by the owner on Mar 6, 2020. It is now read-only.

@apply not working in imported css with a {} only #477

Open
Braincoke opened this issue Mar 5, 2020 · 2 comments
Open

@apply not working in imported css with a {} only #477

Braincoke opened this issue Mar 5, 2020 · 2 comments

Comments

@Braincoke
Copy link

I am a beginner in CSS so this might be obvious to some of you.
I tried to look at similar issues but I fail to see how they could be related.

I created the most simple gridsome project using TailwindCSS.

The project

My main.css looks like this:

@tailwind base;
@tailwind components;

@import "./theme-pink.css";

@tailwind utilities;

The theme-pink.css looks like this:

// This one is correctly applied
div {
    @apply bg-pink-200;
}

// This one is not
a {
    @apply text-red-600;
}

// This one is correctly applied
a:hover {
    @apply text-blue-500;
}

The issue

Every css in theme-pink.css is applied but the one with a { @apply text-red-600; }.

If move the problematic line in main.css then our style is applied:

@tailwind base;
@tailwind components;

@import "./theme-pink.css";

@tailwind utilities;

a {
    @apply text-red-600;
}

Try it yourself

If you feel like helping you can test this with this reproduction code : https://github.com/Braincoke/issue-tailwind-apply.

Would anyone know why this is not working ?

@cytRasch
Copy link

cytRasch commented Mar 5, 2020

Try this:

// all the tailwind stuff
@tailwind base;
@tailwind components;
@tailwind utilities;

// your custom styles
@import "./theme-pink.css";

@Braincoke
Copy link
Author

Oh yeah I had already tried this but unfortunately it didn't work :(

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

No branches or pull requests

2 participants