-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Make resolveConfig available in user land #877
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
Conversation
Adds a new `resolveConfig` file to the project root that can be imported as `tailwindcss/resolveConfig` and used to get a fully merged version of your custom config file. Useful when you want access to your design tokens in JS.
Thanks for this. Would be very useful to have it in the readme somewhere. |
I love this feature but I am unable to use it outside of a laravel project. I'm sure it's something with my babel config or something, but I don't know enough about it to troubleshoot it anymore! My issue is detailed here (hope I'm not breaking a rule with a link to a different forum!) and other's have also had this issue. |
This continues to be an issue for me when trying to use Tailwind with Storybook. See initial issue here: tailwindlabs/discuss#279. Specifically, this is happening now when I try to import the const defaultTheme = require('tailwindcss/defaultTheme')
module.exports = {
theme: {
extend: {
fontFamily: {
sans: ['New Font Name', ...defaultTheme.fontFamily.sans],
},
},
},
plugins: [
require('@tailwindcss/ui'),
],
} |
@kjbrum Could you tell your Node version? |
Node: v13.3.0 |
Would it be possible for you to test with an older version, like 8.9.0? If not, create a minimum reproducible repo? My bet is it has something to do with Tailwind being built with As you can see, v13 is not being tested. If you can do this test, we could trace more problems related to this or rule out this hypothesis. |
@estevanmaito I haven't had a chance to test with an older version of Node, but I was able to fix the error by adding |
This explains the behavior of "sometimes works", with the default configuration of Babel:
|
In case others are facing importing issues for I'm using this with
Since my code bundles the code using
Compare this with
Line 2 in b5f5adf
|
Adds a new
resolveConfig
file to the project root that can be imported astailwindcss/resolveConfig
and used to get a fully merged version of your custom config file.Useful when you want access to your design tokens in JS.
Usage is like this:
Considered having it accept a path but didn't seem that useful. I expect most people needing this would create another file in their
src
directory or similar that sort of proxied to their Tailwind config so they could easily import the fully resolved config instead of having to actually resolve it using the function every time:Closes #832.