Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR will allow you to pipe data to the cli (and the standalone binaries)
We use
-
as a placeholder for the input to indicate that we want to read fromstdin
. There is no way to tell if you getting data via stdin or not (unless you actually get the data). We could use!process.stdin.isTTY
, the issue is that this is also false in CI-like environments.If we actually receive data, then everything works fine as expected, however if we don't receive data then we wait forever. This makes sense if you think about this example:
super-long-running-process-that-gives-you-data-after-10-minutes | npx tailwindcss -o output.css
When do we know that we have to stop watching? We could wait for 100ms, 1s, ... but we don't know when to stop. Halting problem!
As an alternative, a lot of tools use the
-
instead of theinput
file to indicate that we want to wait for stdin. You can try it yourself:cat -
it will just hang forever.Long story short, this now works:
cat input.css | npx tailwindcss -i - -o output.css
Fixes #6865