Skip to content
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

CLI: Use the right base when loading files from stdin #14522

Merged
merged 2 commits into from
Sep 26, 2024

Conversation

philipp-spiess
Copy link
Member

Fixes #14521

When using the CLI to read files from stdin like this:

npx tailwindcss  --input=- -o bar.css < foo.css

We need to set the base path to be the current working directory (process.cwd()). However, cwd() already is a directory and calling dirname() on it did go to the parent directory _which might not have the tailwindcss dependency installed.

@philipp-spiess philipp-spiess force-pushed the fix/base-for-cli-when-read-from-stdin branch from 676a362 to 98fe613 Compare September 26, 2024 09:22
@thecrypticace
Copy link
Contributor

We should add a test for this if we can

@philipp-spiess
Copy link
Member Author

@thecrypticace added ✅

@thecrypticace
Copy link
Contributor

thecrypticace commented Sep 26, 2024

@philipp-spiess I think the test should have a relative import to correctly catch this case yeah?

@thecrypticace
Copy link
Contributor

ah wait nvm this test is sufficient b/c the import for tailwind would fail too b/c node_modules in a different dir. LGTM

@philipp-spiess philipp-spiess merged commit 89f0047 into next Sep 26, 2024
3 checks passed
@philipp-spiess philipp-spiess deleted the fix/base-for-cli-when-read-from-stdin branch September 26, 2024 10:32
Copy link

@CharlesCowan CharlesCowan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

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

Successfully merging this pull request may close these issues.

cli: Reading from stdin is broken in 4.0.0-alpha.25
3 participants