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

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

@Braincoke

Description

@Braincoke

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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions