Skip to content

Commit

Permalink
improve the Tailwind CSS CLI output when nothing changed
Browse files Browse the repository at this point in the history
When we observe that no new candidates were found, we didn't write to
disk because nothing really changed. There is also no need to
re-optimize (minify / lightningcss) when nothing changed.

But this had a side effect that when nothing changes that you didn't see
any output.

Typically you are changing things, so it's not really a problem. But the
moment you use a class that already existed you also don't get any
output because we have a shared cache.

This improves that by always having some output.
  • Loading branch information
RobinMalfait committed Sep 5, 2024
1 parent 15d1714 commit 5ca1224
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/@tailwindcss-cli/src/commands/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,11 @@ export async function handle(args: Result<ReturnType<typeof options>>) {

// No candidates found which means we don't need to rebuild. This can
// happen if a file is detected but doesn't match any of the globs.
if (newCandidates.length <= 0) return
if (newCandidates.length <= 0) {
let end = process.hrtime.bigint()
eprintln(`Done in ${formatDuration(end - start)}`)
return
}

compiledCss = compiler.build(newCandidates)
}
Expand Down

0 comments on commit 5ca1224

Please sign in to comment.