May 2022
Intermediate to advanced
104 pages
2h 24m
English
You can access Tailwind configuration from JavaScript. This is useful if you want to use those values to create dynamic behavior in your JavaScript framework. You might have some kind of custom animation that needs to respect existing colors or spacing, or who knows what.
Whatever you want to do, Tailwind provides a resolveConfig method that takes as an argument the Tailwind configuration object and allows you to query the configuration—the full configuration, not only your overrides in the file:
| | import resolveConfig from 'tailwindcss/resolveConfig' |
| | import myConfig from './tailwind.config.js' |
| | |
| | const tailwindConfig = resolveConfig(myConfig) |
| | |
| | tailwindConfig.theme.colors |
The resulting object from resolveConfig ...
Read now
Unlock full access