Skip to content

@apply No Longer Works in .less Files After Upgrading to Tailwind CSS v4 #20209

Description

@saeidi-dev

Describe the bug
After upgrading from Tailwind CSS v3 to v4, all @apply directives inside .less files are broken. The build fails and styles are not applied.

Environment

  • Tailwind CSS: v4.x
  • Previous version: v3.x
  • Preprocessor: Less

To Reproduce

  1. Have a project using Tailwind CSS v3 with .less files containing @apply
  2. Upgrade to Tailwind CSS v4
  3. Run the build
  4. Observe errors related to @apply not being recognized in .less files

Expected behavior
@apply should work in .less files as it did in v3, or a clear migration path should be provided.

Current behavior
Build fails with errors. @apply directives inside .less files are not processed by Tailwind v4.

Additional context
I have a large codebase with many .less files heavily using @apply. Migrating all of them is a significant effort.

Question
What is the recommended migration path for projects using @apply inside .less files?
Is there any workaround or compatibility layer planned for v4?

I understand that v4 is designed as a standalone CSS build tool and is not intended to be used alongside preprocessors like Less or Sass. However, a migration guide or an automated upgrade tool that handles .less files would be greatly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions