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

Support for recursive @apply #66

Closed
@rolandleth

Description

@rolandleth

All of these work with tailwindcss, but with @tailwindcss/jit they don't, no matter the order of bg-white and some-class:

@layer components {
    .some-class {
        @apply bg-red-500;
    }

    .some-other-class {
        @apply bg-white some-class;
    }
}
@layer components {
    .some-class {
        @apply bg-red-500;
    }

    .some-other-class {
        @apply bg-white;
        @apply some-class;
    }
}
/* this one even removes everything from `.some-other-class` */
@layer components {
    .some-class {
        background-color: red;
    }

    .some-other-class {
        @apply bg-white some-class;
    }
}

It looks like --tw variables aren't overwritten; in these examples, background-color is always rgba(255, 255, 255, var(--tw-bg-opacity)).

This is the only I saw it works, but it's weird and the only reason it's working is that the explicit background-color replaces the one set via @apply (final value is red, so it doesn't go through TW):

@layer components {
    .some-class {
        background-color: red;
    }

    .some-other-class {
        @apply bg-white;
        @apply some-class; /* reversing them doesn't work */
    }
}

Metadata

Metadata

Assignees

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