Enable support for boolean values
Hartoeft opened this issue · comments
Describe the bug
Note: I'm using typescript for the configuration, which is supported in tailwindcss v3.3.2
If i have a tailwind configuration with a boolean value, then I get the following error message.
/.../.pnpm/tailwindcss-themer@3.1.0_tailwindcss@3.3.2/node_modules/tailwindcss-themer/lib/utils/themeUtils.js:49
throw new Error(`unusable value found in config on path "${pathSteps.join('.')}"`);
It happens when add the following configuration to tailwind theme
theme: {
container: {
center: true,
},
}
Your minimal, reproducible example
https://stackblitz.com/edit/vitejs-vite-d1g2vm?file=tailwind.config.ts
Steps to reproduce
- Go to
tailwind.config.ts
in provided stackblitz link - Have a look at the
center: true
. It break because the only allowed values are string or numbers
Expected behavior
I would expect the center: true
will work with booleans, so it works with the tailwindcss documentation
Link to tailwindcss documentation for centering containers:
https://tailwindcss.com/docs/container#centering-by-default
How often does this bug happen?
None
Screenshots or Videos
No response
Platform
- all platforms
tailwindcss-themer version
v3.1.0
Additional context
No response
Start a new pull request in StackBlitz Codeflow.
This issue has been automatically marked stale because it it received no activity for 60 days. If you wish to keep this open, please leave a comment. Thanks.
Thanks for opening this!
I see your issue, and unfortunately, I don't think that value is something that this plugin can configure. This plugin can only theme values that get injected into css rules.
When it comes to container: true/false
this configures tailwind to generate
/* when false or undefined */
.container {
width: 100%
}
/* when true */
.container {
width: 100%;
margin-right: auto;
margin-left: auto
}
Because this config value isn't a single css rule, this plugin doesn't support that. I can update the docs to reflect accordingly.
I'm open to ideas and pull requests if you think otherwise though! Let me know what you think.
For now, I'll close this as expected behavior.