-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
feat: generate theme.json from bud.config.js
#2999
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
theme.json from bud.config.js
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
|
I'm running into this when using a callback with
.themeJson((theme) => {
theme.set("typography.customFontSize", true);
return theme;
})This nests a duplicate {
"__generated__": "⚠️ This file is generated. Do not edit.",
"$schema": "https://schemas.wp.org/trunk/theme.json",
"version": 2,
"settings": {
"ident": "container",
"repository": {
"path": "/site/wp-content/themes/sage-10/theme.json",
"settings": {
"color": {
"custom": false,
"customGradient": false
},
"custom": {
"spacing": {},
"typography": {
"font-size": {},
"line-height": {}
}
},
"spacing": {
"padding": true,
"units": [
"px",
"%",
"em",
"rem",
"vw",
"vh"
]
},
"typography": {
"customFontSize": false,
"dropCap": false
}
}
}
}
}It all works if I use standard json with |
|
this would obviously need to be updated, but I'm thinking we can revisit now. This: app.wpjson
.settings((theme) => theme.set("typography.customFontSize", true))
.enable();Yields the expected result: {
"__generated__": "⚠️ This file is generated. Do not edit.",
"$schema": "https://schemas.wp.org/trunk/theme.json",
"version": 2,
"settings": {
"color": {
"custom": false,
"customGradient": false
},
"custom": {
"spacing": {},
"typography": {
"font-size": {},
"line-height": {}
}
},
"spacing": {
"padding": true,
"units": [
"px",
"%",
"em",
"rem",
"vw",
"vh"
]
},
"typography": {
"customFontSize": true,
"dropCap": false
}
}
}
app.wpjson.useTailwindColors().enable() app.wpjson
.setOption("settings", (settings) => ({
...settings,
typography: {
...(settings?.typography ?? {}),
customFontSize: true,
},
}))
.enable();Tested w/ 6.3.5 |
|
I've added this into a new site build and in my limited time with it so far, I agree this is in a place where it's working as expected. 👍 |
|
Same here! All working for me. Great feature. |
4cfc448 to
dbf1a4e
Compare
dbf1a4e to
1cd4fbd
Compare
0749047 to
b063fa0
Compare
|
The script does not include the global styles node at the right position. The generated theme.json looks like this: But the styles node a t the end should be placed outside the settings node: This is the setup in bud.config.mjs Or am I missing something? UPDATE: Solved using |
This PR
theme.jsonfrombud.config.jstheme.jsonpalette fromtailwind.config.jsSee: updated @roots/sage documentation on theme.json support
TODOs