-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Adds support for tailwind.config.cjs
files
#3181
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3181 +/- ##
==========================================
+ Coverage 93.28% 93.33% +0.05%
==========================================
Files 178 178
Lines 1831 1846 +15
Branches 323 328 +5
==========================================
+ Hits 1708 1723 +15
Misses 105 105
Partials 18 18
Continue to review full report at Codecov.
|
This will also likely need a small note added to the docs and support in |
4d1ed81
to
80b393b
Compare
Thanks! |
* feat: automatically init and resolve tailwind.config.cjs files * test: add tests for default tailwind.config.cjs resolution * fix `cjsConfigFile` constant * Fix JSDoc type of isModule
This PR adds default resolution and
npx tailwind init
support fortailwind.config.cjs
files.Currently, users who rely on Node ESM with
"type": "module"
(officially supported sincenode@12.17.0
) must manuallyrequire
and pass their Tailwind config file to Tailwind.Implementing true
esm
-compliant config files would likely be a large undertaking (requested in #2284), but this PR is a fairly simple stop-gap. With these changes, ESM users will now have the exact same DX as CJS users.Changes
tailwind.config.cjs
file if one existsnpx tailwind init
will automatically generate atailwind.config.cjs
file when run inside of a project with"type": "module"
inpackage.json
npx tailwind init -p
will generate atailwind.config.cjs
file and apostcss.config.cjs
file when run inside of a project with"type": "module"
inpackage.json