Directory

Add a theme.json editor · Issue #491 · WordPress/create-block-theme · GitHub
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

Add a theme.json editor #491

Closed
creativecoder opened this issue Dec 19, 2023 · 6 comments · Fixed by #520
Closed

Add a theme.json editor #491

creativecoder opened this issue Dec 19, 2023 · 6 comments · Fixed by #520
Labels
enhancement New feature or request
Milestone

Comments

@creativecoder
Copy link
Contributor

I'm seeing that even theme builders who work mainly from the Global styles interface still need to directly edit theme.json files for some settings.

Adding a theme.json editor to Create Block Theme could have multiple benefits:

  • Help avoid needing to switch to a text editor to make these changes
  • Show theme.json structure and valid settings to speed up workflows and provide built in documentation

A super basic version of this would be enabling the existing theme file editor to access theme.json.

A more advanced version could use the schema of theme.json to show what options are available and valid for the area of the file you are working in, perhaps using autocomplete, or having a more structured interface, like checkboxes for booleans and drop-downs when there is a limited set of valid choices.

@creativecoder creativecoder added the enhancement New feature or request label Dec 19, 2023
@pbking pbking added this to the 1.14 milestone Mar 8, 2024
@pbking
Copy link
Contributor

pbking commented Mar 8, 2024

Consider linking to this editor as a first pass: /wp-admin/theme-editor.php?file=theme.json&theme=twentytwentyfour

Image

@pbking pbking linked a pull request Mar 19, 2024 that will close this issue
1 task
@richtabor
Copy link
Member

We don't recommend editing the theme's theme.json file though? I think this can easily create confusion as global style changes are saved for users during an update while a theme's theme.json file will be overwritten.

@richtabor
Copy link
Member

A more advanced version could use the schema of theme.json to show what options are available and valid for the area of the file you are working in, perhaps using autocomplete, or having a more structured interface, like checkboxes for booleans and drop-downs when there is a limited set of valid choices.

I lean towards not trying to replicate a solid IDE; it's a lot of work and maintenance—for little benefit.

@richtabor
Copy link
Member

richtabor commented Mar 25, 2024

I'm seeing that even theme builders who work mainly from the Global styles interface still need to directly edit theme.json files for some settings.

Do we have a working list of these that we can help migrate to UI? Perhaps CBT can add the more nuanced theme.json controls that core may not add. CBT can add those that are more likely to be integrated as well, as initial explorations — much like how the font library progressed.

This seems like a more rewarding effort.

@mikachan
Copy link
Member

Do we have a working list of these that we can help migrate to UI?

We do have them written down but they're not yet triaged. We're planning on publishing a roadmap for the plugin so I think that will help clear up the plans for what goes into CBT or Core.

We don't recommend editing the theme's theme.json file though?

I understand that it's not recommended, but from our recent discussions with theme builders, this is a sought-after feature. I think we could ship the simple version first and then see what the feedback is from there.

@bacoords
Copy link

I understand that it's not recommended, but from our recent discussions with theme builders, this is a sought-after feature. I think we could ship #520 first and then see what the feedback is from there.

Agreed - there are still SO many design possibilities in theme.json that you can't do in the site editor.

I lean towards not trying to replicate a solid IDE; it's a lot of work and maintenance—for little benefit.

There are codemirror extensions (example) for showing JSON schema hints and linting which could be helpful for the initial version without too much overhead / debt. It would pull in basic info about theme.json and help you validate before saving.


Just noting that it seems that the initial plan here (based on the PR) is to actually edit the current theme's theme.json file, similar to how the theme "metadata" panel works. Just pointing this out as I think it'll be an additional education piece that if some users are using CBT to design a child theme, they'll need to generate that child theme before they use some of these tools, especially because they'll need to save to see the changes in the editor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants