Skip to content
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

Allow special user defined settings to theme.json #34755

Closed
mkkeck opened this issue Sep 11, 2021 · 4 comments
Closed

Allow special user defined settings to theme.json #34755

mkkeck opened this issue Sep 11, 2021 · 4 comments
Labels
[Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Enhancement A suggestion for improvement.

Comments

@mkkeck
Copy link

mkkeck commented Sep 11, 2021

What problem does this address?

It would be nice to have a section in theme.json for settings, which are used for kind of 'special user defined' which is not parsed by Gutenberg/WordPress.

Using workflows and build tools (Webpack, Babel, Sass) which could import the 'special user defined' (and of course other settings to) for getting these settings needed to build and compile. With this, a theme developer may be able, to adjust all settings at a centralized file.

I have many settings, which I have to set several times - for sass, javascript and php. Why not use the theme.json as an centralized config file and parse or import it every where it is needed?

What is your proposed solution?

Adding a section to theme.json, which is not automatic parsed, modified or overwritten by WordPress/Gutenberg core. Make these section clear to all developers with a specific name, for example site, sitewide or what ever.

@annezazu annezazu added [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. labels Sep 24, 2021
@oandregal
Copy link
Member

Hey Michael, I've got two thoughts about this.

You can already do it. It's just not "sanctioned" by WordPress. Any setting that is present in the file but is not valid according to the schema will be ignored. If a specific tool requires data stored in a certain format in theme.json people will use it, similarly to what happens with package.json for npm: there are fields there that are not documented or used by the official npm documentation.

The other thought is that I'm not sure it's a good idea to use this as a place to put "all the things". The file has a specific goal, which is helping themes. Things like perhaps generating the required "style.css" file from data stored in theme.json would be cool to have. Starting to pollute the file with things unrelated to themes can be confusing.

@mkkeck
Copy link
Author

mkkeck commented Sep 24, 2021

@oandregal Hi André,
the main reason was for adding extra configs for the theme like social services with the #19041 (comment)

@oandregal
Copy link
Member

Thanks for sharing, Michael. This is a topic that have popped up lately in a few PRs and issues. I feel it merits discussion in a centralized place. Created #35114

@ellatrix ellatrix added the Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json label Aug 16, 2023
@jordesign jordesign added the [Type] Enhancement A suggestion for improvement. label Sep 14, 2023
@jordesign jordesign changed the title Adding special user defined settings to theme.json Allow special user defined settings to theme.json Sep 14, 2023
@ramonjd
Copy link
Member

ramonjd commented Apr 8, 2024

Going to close this given that it's "technically" possible and #35114 to add anything to theme.json.

Social icons related discussions can remain on #19041 or in the Icon registration discussion:

Feel free to reopen if you think this specific feature is still more widely relevant.

Thanks!

@ramonjd ramonjd closed this as completed Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

6 participants