Skip to content

Instantly share code, notes, and snippets.

@jasperf
Last active March 16, 2026 01:36
Show Gist options
  • Select an option

  • Save jasperf/98d0b0a42485c35d9b5461c3109ec6fb to your computer and use it in GitHub Desktop.

Select an option

Save jasperf/98d0b0a42485c35d9b5461c3109ec6fb to your computer and use it in GitHub Desktop.
# Check specifically for font-size violations in all target files
for f in spa-booking-cta wellness-cover-highlight fandb-amenities fandb-chef-profile fandb-hours-location fandb-testimonials-food legal-hero-with-stats
menu-daily-specials menu-drinks-grid menu-food-grid menu-pricing-table; do
if grep -qP "font-size:\s*\d+\.?\d*(px|rem|em)" ~/code/imagewize.com/demo/web/app/themes/elayne/patterns/$f.php 2>/dev/null; then
echo "FAIL: $f.php has font-size violations"
else
echo "PASS: $f.php - no font-size violations"
fi
done
python3 -c "
content = open('/Users/user/code/imagewize.com/demo/web/app/themes/elayne/patterns/menu-drinks-grid.php').read()
# h2: 3rem → large
old = '{\"textAlign\":\"center\",\"style\":{\"typography\":{\"fontSize\":\"3rem\",\"fontWeight\":\"400\",\"fontStyle\":\"normal\"},\"elements\":{\"link\":{\"colo
r\":{\"text\":\"var:preset|color|primary\"}}}},\"textColor\":\"primary\",\"fontFamily\":\"heading\"} -->\n<h2 class=\"wp-block-heading has-text-align-center
has-primary-color has-text-color has-link-color has-heading-font-family\" style=\"font-size:3rem;font-style:normal;font-weight:400\">'
new = '{\"textAlign\":\"center\",\"style\":{\"typography\":{\"fontWeight\":\"400\",\"fontStyle\":\"normal\"},\"elements\":{\"link\":{\"color\":{\"text\":\"var:pr
eset|color|primary\"}}}},\"textColor\":\"primary\",\"fontFamily\":\"heading\",\"fontSize\":\"large\"} -->\n<h2 class=\"wp-block-heading has-text-align-center
has-primary-color has-text-color has-link-color has-heading-font-family has-large-font-size\" style=\"font-style:normal;font-weight:400\">'
c = content.count(old); print(f'h2 3rem: {c}'); content = content.replace(old, new)
# h3 section headings (1.75rem, fontWeight:500, fontStyle:normal) - different textColor/fontFamily variants
# Variant 1: base color, main-accent bg
old = '{\"level\":3,\"style\":{\"typography\":{\"fontSize\":\"1.75rem\",\"fontWeight\":\"500\",\"fontStyle\":\"normal\"},\"elements\":{\"link\":{\"color\":{\"tex
t\":\"var:preset|color|base\"}}}},\"textColor\":\"base\",\"fontFamily\":\"decorative\"} -->\n<h3 class=\"wp-block-heading has-base-color has-text-color
has-link-color has-decorative-font-family\" style=\"font-size:1.75rem;font-style:normal;font-weight:500\">'
new = '{\"level\":3,\"style\":{\"typography\":{\"fontWeight\":\"500\",\"fontStyle\":\"normal\"},\"elements\":{\"link\":{\"color\":{\"text\":\"var:preset|color|ba
se\"}}}},\"textColor\":\"base\",\"fontFamily\":\"decorative\",\"fontSize\":\"medium\"} -->\n<h3 class=\"wp-block-heading has-base-color has-text-color
has-link-color has-decorative-font-family has-medium-font-size\" style=\"font-style:normal;font-weight:500\">'
c = content.count(old); print(f'h3 1.75rem base: {c}'); content = content.replace(old, new)
# Variant 2: border-light color (bieren)
old = '{\"level\":3,\"style\":{\"typography\":{\"fontSize\":\"1.75rem\",\"fontWeight\":\"500\"},\"elements\":{\"link\":{\"color\":{\"text\":\"var:preset|color|bo
rder-light\"}}}},\"textColor\":\"border-light\",\"fontFamily\":\"decorative\"} -->\n<h3 class=\"wp-block-heading has-border-light-color has-text-color
has-link-color has-decorative-font-family\" style=\"font-size:1.75rem;font-weight:500\">'
new = '{\"level\":3,\"style\":{\"typography\":{\"fontWeight\":\"500\"},\"elements\":{\"link\":{\"color\":{\"text\":\"var:preset|color|border-light\"}}}},\"textCo
lor\":\"border-light\",\"fontFamily\":\"decorative\",\"fontSize\":\"medium\"} -->\n<h3 class=\"wp-block-heading has-border-light-color has-text-color
has-link-color has-decorative-font-family has-medium-font-size\" style=\"font-weight:500\">'
c = content.count(old); print(f'h3 1.75rem border-light: {c}'); content = content.replace(old, new)
# Variant 3: main-accent color (hapjes)
old = '{\"level\":3,\"style\":{\"typography\":{\"fontSize\":\"1.75rem\",\"fontWeight\":\"500\",\"fontStyle\":\"normal\"},\"elements\":{\"link\":{\"color\":{\"tex
t\":\"var:preset|color|main-accent\"}}}},\"textColor\":\"main-accent\",\"fontFamily\":\"decorative\"} -->\n<h3 class=\"wp-block-heading has-main-accent-color
has-text-color has-link-color has-decorative-font-family\" style=\"font-size:1.75rem;font-style:normal;font-weight:500\">'
new = '{\"level\":3,\"style\":{\"typography\":{\"fontWeight\":\"500\",\"fontStyle\":\"normal\"},\"elements\":{\"link\":{\"color\":{\"text\":\"var:preset|color|ma
in-accent\"}}}},\"textColor\":\"main-accent\",\"fontFamily\":\"decorative\",\"fontSize\":\"medium\"} -->\n<h3 class=\"wp-block-heading has-main-accent-color
has-text-color has-link-color has-decorative-font-family has-medium-font-size\" style=\"font-style:normal;font-weight:500\">'
c = content.count(old); print(f'h3 1.75rem main-accent: {c}'); content = content.replace(old, new)
open('~/code/imagewize.com/demo/web/app/themes/elayne/patterns/menu-drinks-grid.php', 'w').write(content)
print('Done h3s')
"
content = open('~/code/imagewize.com/demo/web/app/themes/elayne/patterns/menu-food-grid.php').read()
# 0.8125rem paragraphs → xx-small (multiple variants with different textColor)
# main-accent textColor
old = '{\"style\":{\"typography\":{\"fontSize\":\"0.8125rem\"},\"spacing\":{\"margin\":{\"top\":\"0\"}}},\"textColor\":\"main-accent\",\"fontFamily\":\"body\"}
-->\n<p class=\"has-main-accent-color has-text-color has-body-font-family\" style=\"margin-top:0;font-size:0.8125rem\">'
new = '{\"style\":{\"spacing\":{\"margin\":{\"top\":\"0\"}}},\"textColor\":\"main-accent\",\"fontFamily\":\"body\",\"fontSize\":\"xx-small\"} -->\n<p
class=\"has-main-accent-color has-text-color has-body-font-family has-xx-small-font-size\" style=\"margin-top:0\">'
c = content.count(old); print(f'0.8125 main-accent: {c}'); content = content.replace(old, new)
# primary-alt textColor
old = '{\"style\":{\"typography\":{\"fontSize\":\"0.8125rem\"},\"spacing\":{\"margin\":{\"top\":\"0\"}}},\"textColor\":\"primary-alt\",\"fontFamily\":\"body\"}
-->\n<p class=\"has-primary-alt-color has-text-color has-body-font-family\" style=\"margin-top:0;font-size:0.8125rem\">'
new = '{\"style\":{\"spacing\":{\"margin\":{\"top\":\"0\"}}},\"textColor\":\"primary-alt\",\"fontFamily\":\"body\",\"fontSize\":\"xx-small\"} -->\n<p
class=\"has-primary-alt-color has-text-color has-body-font-family has-xx-small-font-size\" style=\"margin-top:0\">'
c = content.count(old); print(f'0.8125 primary-alt: {c}'); content = content.replace(old, new)
# base textColor
old = '{\"style\":{\"typography\":{\"fontSize\":\"0.8125rem\"},\"spacing\":{\"margin\":{\"top\":\"0\"}}},\"textColor\":\"base\",\"fontFamily\":\"body\"} -->\n<p
class=\"has-base-color has-text-color has-body-font-family\" style=\"margin-top:0;font-size:0.8125rem\">'
new = '{\"style\":{\"spacing\":{\"margin\":{\"top\":\"0\"}}},\"textColor\":\"base\",\"fontFamily\":\"body\",\"fontSize\":\"xx-small\"} -->\n<p
class=\"has-base-color has-text-color has-body-font-family has-xx-small-font-size\" style=\"margin-top:0\">'
c = content.count(old); print(f'0.8125 base: {c}'); content = content.replace(old, new)
open('~code/imagewize.com/demo/web/app/themes/elayne/patterns/menu-food-grid.php', 'w').write(content)
print('Done 0.8125')
"
python3 -c "
content = open('/Users/user/code/imagewize.com/demo/web/app/themes/elayne/patterns/menu-drinks-grid.php').read()
# regular menu item paragraphs (no className): 0.9375rem → x-small
old = '{\"style\":{\"typography\":{\"fontSize\":\"0.9375rem\",\"fontWeight\":\"500\"}},\"fontFamily\":\"body\"} -->\n<p class=\"has-body-font-family\"
style=\"font-size:0.9375rem;font-weight:500\">'
new = '{\"style\":{\"typography\":{\"fontWeight\":\"500\"}},\"fontFamily\":\"body\",\"fontSize\":\"x-small\"} -->\n<p class=\"has-body-font-family
has-x-small-font-size\" style=\"font-weight:500\">'
c = content.count(old); print(f'0.9375 plain: {c}'); content = content.replace(old, new)
# menu-price paragraphs (with className): 0.9375rem → x-small (fontStyle:normal variant)
old =
'{\"className\":\"menu-price\",\"style\":{\"typography\":{\"fontSize\":\"0.9375rem\",\"fontWeight\":\"500\",\"fontStyle\":\"normal\"}},\"fontFamily\":\"body\"}
-->\n<p class=\"menu-price has-body-font-family\" style=\"font-size:0.9375rem;font-style:normal;font-weight:500\">'
new =
'{\"className\":\"menu-price\",\"style\":{\"typography\":{\"fontWeight\":\"500\",\"fontStyle\":\"normal\"}},\"fontFamily\":\"body\",\"fontSize\":\"x-small\"}
-->\n<p class=\"menu-price has-body-font-family has-x-small-font-size\" style=\"font-style:normal;font-weight:500\">'
c = content.count(old); print(f'0.9375 price normal: {c}'); content = content.replace(old, new)
# menu-price paragraphs (with className): 0.9375rem → x-small (no fontStyle variant)
old = '{\"className\":\"menu-price\",\"style\":{\"typography\":{\"fontSize\":\"0.9375rem\",\"fontWeight\":\"500\"}},\"fontFamily\":\"body\"} -->\n<p
class=\"menu-price has-body-font-family\" style=\"font-size:0.9375rem;font-weight:500\">'
new = '{\"className\":\"menu-price\",\"style\":{\"typography\":{\"fontWeight\":\"500\"}},\"fontFamily\":\"body\",\"fontSize\":\"x-small\"} -->\n<p
class=\"menu-price has-body-font-family has-x-small-font-size\" style=\"font-weight:500\">'
c = content.count(old); print(f'0.9375 price: {c}'); content = content.replace(old, new)
open('~/code/imagewize.com/demo/web/app/themes/elayne/patterns/menu-drinks-grid.php', 'w').write(content)
print('Done 0.9375')
"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment