Skip to content

[BUG] Not clean old classes on --watch rebuild #14180

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
PatrykKuniczak opened this issue Aug 13, 2024 · 2 comments
Closed

[BUG] Not clean old classes on --watch rebuild #14180

PatrykKuniczak opened this issue Aug 13, 2024 · 2 comments

Comments

@PatrykKuniczak
Copy link

PatrykKuniczak commented Aug 13, 2024

What version of Tailwind CSS are you using?

For example: v3.4.9

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

For example:
https://github.com/PatrykKuniczak/tw-reproduce/blob/main/package.json

What version of Node.js are you using?

For example: v20.11.1

What browser are you using?

For example: Chrome (Latest)

What operating system are you using?

For example: Windows 11

Reproduction URL

A Tailwind Play link or public GitHub repo that includes a minimal reproduction of the bug. Please do not link to your actual project, what we need instead is a minimal reproduction in a fresh project without any unnecessary code. This means it doesn't matter if your real project is private/confidential, since we want a link to a separate, isolated reproduction anyways.

Describe your issue

Run npm dev for reproduce, what's on video.

untitled.tailwind-output.css.2024-08-13.17-07-27.mp4

As you can see, --watch flag works well, but it leaves unnecessary old classes in output file.
I think it checks only, if class don't exists yet and create it, or even don't check nothing, overwrite file with brute force :)

I was used this classes, only once:

image

image

@thecrypticace
Copy link
Contributor

Hi! This behavior is an intentional performance optimization for development. It makes it so that we don't have to:

  • Rescan all files for every change (bad for memory and CPU); OR
  • Keep track of which files every class appears in (bad for memory usage)

If you want the unused classes to be removed you can do a fresh build. Hope that helps!

@PatrykKuniczak
Copy link
Author

@thecrypticace Yeah, i know i can do fresh build, but it seems strange.

Thanks for answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants