Fix sync script :root parsing, add offline/editor/user to minify. Bump 03.10.06
Some checks failed
Repo Health / Access control (push) Successful in 1s
Auto-Update SHA Hash / Update SHA-256 Hash in updates.xml (release) Failing after 4s
Repo Health / Release configuration (push) Failing after 4s
Repo Health / Scripts governance (push) Successful in 4s
Repo Health / Repository health (push) Failing after 4s

- Sync: compare against standard theme (not deleted custom starters)
- Sync: handle :root{ on same line (dark.standard.css format)
- Minify: added offline.css, editor.css, a11y-high-contrast.css,
  user.css, user.js to minification list

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jonathan Miller
2026-04-18 17:34:59 -05:00
parent eaf68762e5
commit 8c5473b140
6 changed files with 36 additions and 31 deletions

View File

@@ -34,11 +34,11 @@ final class MokoCssVarSync
*/
private const PALETTES = [
[
'starter' => 'templates/light.custom.css',
'starter' => 'media/css/theme/light.standard.css',
'user' => 'media/templates/site/%s/css/theme/light.custom.css',
],
[
'starter' => 'templates/dark.custom.css',
'starter' => 'media/css/theme/dark.standard.css',
'user' => 'media/templates/site/%s/css/theme/dark.custom.css',
],
];
@@ -141,27 +141,27 @@ final class MokoCssVarSync
$depth = 0;
foreach ($lines as $line) {
// Track when we enter :root
// Track when we enter :root (brace may be on same line)
if (!$inRoot && preg_match('/:root/', $line)) {
$inRoot = true;
continue;
// If { is on this same line, don't skip it — just continue processing
if (strpos($line, '{') === false) {
continue;
}
// Fall through to process the rest of this line
}
if (!$inRoot) {
continue;
}
// Track braces
if (strpos($line, '{') !== false) {
$depth++;
// Track braces (skip lines that are ONLY a brace)
$trimmed = trim($line);
if ($trimmed === '{') {
continue;
}
if (strpos($line, '}') !== false) {
$depth--;
if ($depth < 0) {
break; // End of :root
}
continue;
if ($trimmed === '}') {
break; // End of :root
}
// Section comment headers — always include