🩹 Compact fix for color generation in theme.json (#3222)

* Fix for incorrect theme.json generation of colours

* Fix for theme.json color generation

* Compact fix for colour theme.json generation

---------

Co-authored-by: Steve Jones <steve@codewithfeeling.com>
This commit is contained in:
Steve Jones
2025-02-05 22:47:11 +00:00
committed by GitHub
parent 8c91368c4f
commit 04b2404e47

View File

@@ -210,7 +210,8 @@ export function wordpressThemeJson({
return;
}
const rootContent = themeContent.slice(themeContent.indexOf('{') + 1, themeContent.lastIndexOf('}'))
const endIndex = themeContent.lastIndexOf('}');
const rootContent = themeContent.slice(themeContent.indexOf('{') + 1, endIndex === -1 ? undefined : endIndex);
const colorVariables = {}
const colorVarRegex = /--color-([^:]+):\s*([^;}]+)[;}]?/g