From 714a3f44a134aada27c980300a72d5050e5a0f79 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 24 Jan 2026 02:49:11 +0000 Subject: [PATCH] Fix asset naming consistency and add documentation about minifier limitations Co-authored-by: jmiller-moko <230051081+jmiller-moko@users.noreply.github.com> --- src/templates/AssetMinifier.php | 15 +++++++++++++++ src/templates/index.php | 4 ++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/templates/AssetMinifier.php b/src/templates/AssetMinifier.php index 0cc7212..f74ff32 100644 --- a/src/templates/AssetMinifier.php +++ b/src/templates/AssetMinifier.php @@ -21,6 +21,18 @@ defined('_JEXEC') or die; * * Handles minification and cleanup of CSS and JavaScript assets * based on the development mode setting. + * + * IMPORTANT NOTES: + * - This is a BASIC minifier suitable for development/production switching + * - For production builds, consider using professional tools like: + * * CSS: cssnano, clean-css + * * JavaScript: terser, uglify-js, closure-compiler + * - URL preservation in JS is best-effort; complex cases may fail + * - String content preservation is basic; edge cases may exist + * - Does not handle complex string scenarios or regex patterns + * + * The minifier is designed to be "good enough" for automatic switching + * between development and production modes, not for optimal compression. */ class AssetMinifier { @@ -167,6 +179,9 @@ class AssetMinifier $result['deleted'] = self::deleteMinifiedFiles($mediaPath); } else { // Create minified versions of CSS and JS files + // NOTE: This list is hardcoded for predictability and to ensure only + // specific template files are minified. Vendor files are excluded as + // they come pre-minified. If you add new template assets, add them here. $files = [ 'css/template.css' => 'css/template.min.css', 'css/user.css' => 'css/user.min.css', diff --git a/src/templates/index.php b/src/templates/index.php index 90bc1ad..0270330 100644 --- a/src/templates/index.php +++ b/src/templates/index.php @@ -133,8 +133,8 @@ try { // Scripts $wa->useScript('template.js' . $assetSuffix); -$wa->useScript('theme-init' . $assetSuffix . '.js'); -$wa->useScript('darkmode-toggle' . $assetSuffix . '.js'); +$wa->useScript('theme-init.js' . $assetSuffix); +$wa->useScript('darkmode-toggle.js' . $assetSuffix); $wa->useScript('vendor.bootstrap-toc.js' . $assetSuffix); // Font scheme (external or local) + CSS custom properties