From bf363068d774a7fc436bf5ee73ed9222b3131d2b Mon Sep 17 00:00:00 2001 From: Chris Sorrentino Date: Tue, 28 Jan 2025 12:03:50 -0500 Subject: [PATCH] improve regex for custom property matching --- resources/js/build/wordpress.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/js/build/wordpress.js b/resources/js/build/wordpress.js index 374f911602..a76777f695 100644 --- a/resources/js/build/wordpress.js +++ b/resources/js/build/wordpress.js @@ -213,7 +213,7 @@ export function wordpressThemeJson({ const rootContent = themeContent.slice(themeContent.indexOf('{') + 1, themeContent.lastIndexOf('}')) const colorVariables = {} - const colorVarRegex = /--color-([^:]+):\s*([^;]+);/g + const colorVarRegex = /--color-([^:]+):\s*([^;}]+)[;}]?/g let match while ((match = colorVarRegex.exec(rootContent)) !== null) { @@ -250,7 +250,7 @@ export function wordpressThemeJson({ }) const fontFamilies = [] - const fontVarRegex = /--font-([^:]+):\s*([^;]+);/g + const fontVarRegex = /--font-([^:]+):\s*([^;}]+)[;}]?/g while ((match = fontVarRegex.exec(rootContent)) !== null) { const [, name, value] = match if (!name.includes('-feature-settings') && !name.includes('-variation-settings')) { @@ -263,7 +263,7 @@ export function wordpressThemeJson({ } const fontSizes = [] - const fontSizeVarRegex = /--text-([^:]+):\s*([^;]+);/g + const fontSizeVarRegex = /--text-([^:]+):\s*([^;}]+)[;}]?/g while ((match = fontSizeVarRegex.exec(rootContent)) !== null) { const [, name, value] = match if (!name.includes('--line-height')) {