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

Failure to parse theme.json should be a lot more obvious #32009

Closed
bobbingwide opened this issue May 19, 2021 · 1 comment · Fixed by #32404
Closed

Failure to parse theme.json should be a lot more obvious #32009

bobbingwide opened this issue May 19, 2021 · 1 comment · Fixed by #32404
Assignees
Labels
[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 [Status] In Progress Tracking issues with work in progress [Type] Feedback Issues that relate purely to feedback on a feature that isn't necessarily actionable

Comments

@bobbingwide
Copy link
Contributor

Description

A theme’s global styles are defined in a file called theme.json.

It’s a complicated file in JavaScript Object Notation (JSON ) format.

There are many settings which can have lots of values.

  • You have to get the structure and the syntax correct.
  • If you make any mistake with the syntax then the Global Styles aren’t set.
  • You don’t get any messages.
  • Everything just looks all wrong.
  • If you do make any changes, use a JSON validator to check your syntax.
  • And then check it again for semantics.

You don’t get any messages.

Well, something may be logged to PHP error log.

[19-May-2021 17:06:24 UTC] Error when decoding file schema: Syntax error

Step-by-step reproduction instructions

  1. Install and activate an FSE theme such as TT1 blocks
  2. Edit site
  3. View Global Styles
  4. Delete the first character from theme.json
  5. Edit site
  6. View Global Styles
  7. Notice the difference

Expected behaviour

The fact that theme.json could not be parsed should be made immediately obvious to the user.
This is going to happen an awful lot in the next few months.
The ability to perform problem determination needs to be significantly improved.

Actual behaviour

It just looks awful.

Screenshots or screen recording (optional)

Screen capture after step 3.
image

Screen capture after breaking theme.json in step 4.
image

Code snippet (optional)

WordPress information

  • WordPress version: 5.7.2
  • Gutenberg version: 10.6.0
  • Are all plugins except Gutenberg deactivated? Yes
  • Are you using a default theme (e.g. Twenty Twenty-One)? TT1 blocks

Device information

  • Device: Desktop
  • Operating system: Windows
  • Browser: Chrome
@skorasaurus
Copy link
Member

Want to share that this should be prioritized:

not creating any feedback loop or indications that a theme.json file is not working will create a really negative and frustrating experience for theme developers who will be unsure of how to fix their problem: they'll wonder: "is it a problem with my theme? is it a problem with gutenberg?"

I've ran into this a couple times as well and it was frustrating.

@skorasaurus skorasaurus added [Type] Feedback Issues that relate purely to feedback on a feature that isn't necessarily actionable [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 labels May 25, 2021
@JustinyAhin JustinyAhin self-assigned this Jun 1, 2021
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Jun 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[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 [Status] In Progress Tracking issues with work in progress [Type] Feedback Issues that relate purely to feedback on a feature that isn't necessarily actionable
Projects
None yet
4 participants