Auto-minify CSS/JS: dev mode deletes .min, prod mode regenerates

- helper/minify.php: PHP-based CSS/JS minifier with timestamp caching
- Dev mode ON: deletes all .min.css and .min.js files
- Dev mode OFF: regenerates .min files from source if stale or missing
- Covers template.css, light/dark standard/custom theme CSS, template.js
- No external build tools needed — template is self-contained

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-02 22:05:09 -05:00
parent d98e42a936
commit a8e1ddbb05
2 changed files with 166 additions and 0 deletions

View File

@@ -70,6 +70,10 @@ if ($params_favicon_source) {
}
}
// Minification: dev mode ON → delete .min files; OFF → regenerate if stale
require_once __DIR__ . '/helper/minify.php';
MokoMinifyHelper::sync(JPATH_ROOT . '/' . $templatePath, (bool) $params_developmentmode);
// Core template CSS + JS — use minified when not in development mode
if ($params_developmentmode) {
$wa->useStyle('template.base'); // css/template.css