Fix asset naming consistency and add documentation about minifier limitations

Co-authored-by: jmiller-moko <230051081+jmiller-moko@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-01-24 02:49:11 +00:00
parent 6b6ba7f293
commit 714a3f44a1
2 changed files with 17 additions and 2 deletions

View File

@@ -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',

View File

@@ -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