While trying to run the CLI as a subcommand within a project (running from Rust code), I encountered a challenge where the tailwindcss command would exit rather than watching and rebuilding, even with the -w/--watch flag. It turns out by default that if stdin is closed, tailwindcss will close too to avoid becoming a zombie process, and that you can turn off this behavior with the un-documented flag --watch=always. The code for this is here: https://github.com/tailwindlabs/tailwindcss/blob/next/packages/%40tailwindcss-cli/src/commands/build/index.ts#L218-L224
It would be nice if this flag were documented somewhere.
While trying to run the CLI as a subcommand within a project (running from Rust code), I encountered a challenge where the
tailwindcss
command would exit rather than watching and rebuilding, even with the-w
/--watch
flag. It turns out by default that ifstdin
is closed,tailwindcss
will close too to avoid becoming a zombie process, and that you can turn off this behavior with the un-documented flag--watch=always
. The code for this is here: https://github.com/tailwindlabs/tailwindcss/blob/next/packages/%40tailwindcss-cli/src/commands/build/index.ts#L218-L224It would be nice if this flag were documented somewhere.