Skip to content

@apply seems does not working inside @keyframes #15376

@didix16

Description

@didix16

What version of Tailwind CSS are you using?

v4.0.0-beta.6

What build tool (or framework if it abstracts the build tool) are you using?

Vite 6.0.3

What version of Node.js are you using?

v20.9.0

What browser are you using?

Firefox, Brave

What operating system are you using?

Windows 11

Reproduction URL

Play Tailwindcss - https://play.tailwindcss.com/cprDoyBh5U?file=css

Describe your issue

After following the new changes mentioned on v4 docs, I've tried to add a new animation like this:

@import "tailwindcss";

@theme {
  --animate-pop: 1s ease-out alt-pop-enter, 500ms ease-in 1s alt-pop-leave;

  @keyframes alt-pop-enter {
    from {
      @apply bg-amber-400;
    }
    to {
      @apply bg-red-700;
    }
  }
  @keyframes alt-pop-leave {
    from {
      @apply bg-green-400;
    }
    to {
      @apply bg-blue-600;
    }
  }
}

It seems that does not processed the @apply rule and results in and empty animation keyframes.
Also, only the second @keyframes seems to be included, so the animate-pop does only executes alt-pop-leave, but not both.

EDIT:

BTW, I forgot to mention that if you try to use @apply inside @keyframes oustide @theme, i.e:

@keyframes example {
    from {
        @apply bg-red-400;
    }
    to {
        @apply bg-green-400;
    }
}

Then on the playgroud you get an error saying that you cannot use @apply inside @keyframes.
You can see the error here - https://play.tailwindcss.com/VcoeNIX3rT?file=css

I don't know why. In v3 was working fine. Also in the v4 docs, there's nothing that says to you that you cannot use @apply inside @keyframes.

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