Skip to content

[v4] Tailwind bundles unused css variables, bloating up the css #16145

@GiyoMoon

Description

@GiyoMoon

What version of Tailwind CSS are you using?

v4.0.2

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

Playground

What version of Node.js are you using?

Playground version

What browser are you using?

Chromium

What operating system are you using?

macOS

Reproduction URL

https://play.tailwindcss.com/

Delete the entire html file, switch between v4 and v3 and compare the size of the generated css file.

Describe your issue

Tailwind v4.0 ships all css variables of the default theme, even if they aren't being used. This bloats up the css by a good amount. Default sizes with no classes used in the html:

  • v3 - 1.16kb
  • v4 - 4.01kb
    The size increased by 345%. Is there a way to strip of unused variables without having to "reset" the default theme and define it manually as described in here?

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