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

Theme Export: Exporting a child theme as a standalone theme creates a lot of invalid/nonsensical data in theme.json #51390

Open
porg opened this issue Jun 9, 2023 · 4 comments
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") Needs Testing Needs further testing to be confirmed. [Type] Bug An existing feature does not function as intended

Comments

@porg
Copy link

porg commented Jun 9, 2023

Description

Expectation: The serialized theme.json in the new standalone theme is a proper merge of parent theme + child theme + current user customizations (as in database).

Actual: Far from that. The resulting theme.json is very broken in many regards ( I identified 4 flaws, the expert probably even more). See details below.

Step-by-step reproduction instructions

Reproduction

  1. I had tt3dd as a child block theme of Twenty Twenty Three (aka TT3).

  2. Had too many issues with child block theme. Decided to abandon this workflow paradigm and better work with a standalone theme which starts as a copy of the original TT3.

  3. The child theme tt3dd may has its own mini theme.json (in my case 320 bytes, override only, had no effect anyhow) or not have any own theme.json. The outcome of the following export was the same in both situations for me! See file:
    theme-tt3dd-export-v1.json.txt

  4. With the child theme tt3dd as the active theme I went to: Site Editor → Top level context menu → TOOLS → Export.

  5. This exported the standalone theme which is a merge of the parent theme and the child theme into a ZIP file. Performed some renaming and adaptations in theme.css and functions.php but left the theme.json untouched. This new standalone theme (based upon TT3) now goes by the theme-slug "dd".

Observed anomalies of the theme.json export from an active child theme

I. In the original Twenty Twenty Three theme (see: theme-tt3.json.txt) the palette exists only once:

  • settings → blocks → palette
    • slug: base

II. In theme-tt3dd-export-v1.json.txt there are several anomalies

  1. palette exists twice:
  • settings → blocks → core/group → color → palette

    • slug: base
    • slug: custom-plain-inline-links -- a custom color that I created
  • settings → color → palette → slug: custom-plain-inline-links

    • slug: base -- the base color a second time
    • slug: custom-plain-inline-links -- my custom color a second time
  1. settings → blocks → core/group → layout
  • Seems totally at the wrong place
  • A huge block, nearly 30% extra lines compared to original)
  1. Some harmless, but at least inconsistent
  • Some of the arrays "at the end of a branch" (no more children) have there child attributes in different order in comparison to the original.
  1. Some harmless, but at least inconsistent
  • Some of the arrays "at the end of a branch" (no more children) have there child attributes in different order in comparison to the original, e.g. "fluid": { "max": "1.875rem", "min": "1.75rem" } vs. "fluid": { "min": "1.75rem", "max": "1.875rem" }.

  • Some in the original only have slug+size vs. slug+size+name in the export, e.g. an extra name: "Extra Large" in addition to the slug: "x-large".

Screenshots, screen recording, code snippet

No response

Environment info

  • WordPress 6.2
  • Gutenberg 15.9.1

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

No

@porg
Copy link
Author

porg commented Jun 9, 2023

What I did to nevertheless get a standalone theme from a former child theme:

  • Duplicated a fresh TT3 theme folder.
  • Copied in my custom files from parts/ , templates/, assets/css/
  • Copied in my functions.php and changed the parts which dealt with enqueuing parent/child CSS.
  • Created a handful of edits in theme.json
  • Then after some checking I was fine.

@Thelmachido Thelmachido added [Feature] Full Site Editing [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") Needs Testing Needs further testing to be confirmed. [Type] Bug An existing feature does not function as intended labels Jun 21, 2023
@github-actions
Copy link

Hi,
This issue has gone 30 days without any activity. This means it is time for a check-in to make sure it is still relevant. If you are still experiencing this issue with the latest versions, you can help the project by responding to confirm the problem and by providing any updated reproduction steps.
Thanks for helping out.

@github-actions github-actions bot added the [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. label Jul 22, 2023
@github-actions github-actions bot removed the [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. label Jul 25, 2023
@github-actions
Copy link

Hi,
This issue has gone 30 days without any activity. This means it is time for a check-in to make sure it is still relevant. If you are still experiencing this issue with the latest versions, you can help the project by responding to confirm the problem and by providing any updated reproduction steps.
Thanks for helping out.

@github-actions github-actions bot added the [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. label Aug 24, 2023
@porg
Copy link
Author

porg commented Aug 29, 2023

  • Possibly this had been just a result of malformed JSON.
  • I will leave the issue open.
  • In the coming weeks I will possibly again perform some theme duplication/forking activities, and will then observe very closely, whether I still experience this.

@github-actions github-actions bot removed the [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. label Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") Needs Testing Needs further testing to be confirmed. [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

3 participants