https://github.com/mainej/tailwind-jit-dead-code
demonstration of bug with dead-code elimination in JIT watch mode
https://github.com/mainej/tailwind-jit-dead-code
Last synced: 2 months ago
JSON representation
demonstration of bug with dead-code elimination in JIT watch mode
- Host: GitHub
- URL: https://github.com/mainej/tailwind-jit-dead-code
- Owner: mainej
- Created: 2021-04-17T17:35:05.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-04-17T17:47:56.000Z (about 4 years ago)
- Last Synced: 2024-12-04T16:35:40.956Z (6 months ago)
- Language: JavaScript
- Size: 34.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Problem
This repo demonstrates a problem with dead-code elimination in JIT watch mode.
# Reproduction steps
1. Run `npm install`
2. Run `NODE_ENV=development npx postcss ./styles.css -o ./compiled.css -w`
3. Observe that `compiled.css` contains `.bg-red-500`
4. In `index.html`, remove the `bg-red-500` class## Expected
The `.bg-red-500` class is removed from `compiled.css`.
## Actual
`compiled.css` does not change.
# Comments
`index.html` is the only source file that references bg-red-500 (indeed, it's
the only source file period). Therefore, I expect that removing that class from
`index.html` would would remove it from the compiled css. However, there must
be some caching that keeps it around. In most cases it isn't a problem to have
extra style definitions in the compiled CSS, but it runs counter to the
advertised property that with the JIT, your development CSS is exactly the same
as your production CSS.