diff --git a/src/language/en-GB/tpl_moko-cassiopeia.ini b/src/language/en-GB/tpl_moko-cassiopeia.ini index 8611efe..4455548 100644 --- a/src/language/en-GB/tpl_moko-cassiopeia.ini +++ b/src/language/en-GB/tpl_moko-cassiopeia.ini @@ -16,8 +16,8 @@ MOKO-CASSIOPEIA="MOKO-CASSIOPEIA Site template" TPL_MOKO-CASSIOPEIA_XML_DESCRIPTION="

MOKO-CASSIOPEIA Template Description

MOKO-CASSIOPEIA 3.0 continues Joomla’s tradition of space-themed default templates— building on the legacy of Solarflare (Joomla 1.0), Milkyway (Joomla 1.5), and Protostar (Joomla 3.0).

This template is a customized fork of the Cassiopeia template introduced in Joomla 4, preserving its modern, accessible, and mobile-first foundation while introducing new stylistic enhancements and structural refinements specifically tailored for use by Moko Consulting.

Code Attribution

This template is based on the original Cassiopeia template developed by the Joomla! Project and released under the GNU General Public License.

Modifications and enhancements have been made by Moko Consulting in accordance with open-source licensing standards.

It includes integration with Bootstrap TOC, an open-source table of contents generator by A. Feld, licensed under the MIT License.

All third-party libraries and assets remain the property of their respective authors and are credited within their source files where applicable.

" ; ===== System / layout ===== -TPL_MOKO-CASSIOPEIA_DEVELOPMENTMODE_LABEL="Development Mode" -TPL_MOKO-CASSIOPEIA_DEVELOPMENTMODE_DESC="When enabled, uses non-minified CSS/JS assets for easier debugging. When disabled, automatically creates and uses minified versions for better performance. Switching modes will automatically create or delete .min files as needed." +TPL_MOKO-CASSIOPEIA_DEVELOPMENTMODE_LABEL="Development Mode (Deprecated)" +TPL_MOKO-CASSIOPEIA_DEVELOPMENTMODE_DESC="This setting is deprecated. Asset minification is now controlled by Joomla's cache system (System > Global Configuration > System > Cache Settings). When cache is enabled, minified assets are used. When cache is disabled, non-minified assets are used for debugging." TPL_MOKO-CASSIOPEIA_FLUID_LABEL="Layout" TPL_MOKO-CASSIOPEIA_STATIC="Static" TPL_MOKO-CASSIOPEIA_FLUID="Fluid" diff --git a/src/language/en-US/tpl_moko-cassiopeia.ini b/src/language/en-US/tpl_moko-cassiopeia.ini index 322ac6f..119ebfe 100644 --- a/src/language/en-US/tpl_moko-cassiopeia.ini +++ b/src/language/en-US/tpl_moko-cassiopeia.ini @@ -16,8 +16,8 @@ MOKO-CASSIOPEIA="MOKO-CASSIOPEIA Site template" TPL_MOKO-CASSIOPEIA_XML_DESCRIPTION="

MOKO-CASSIOPEIA Template Description

MOKO-CASSIOPEIA 3.0 continues Joomla’s tradition of space-themed default templates— building on the legacy of Solarflare (Joomla 1.0), Milkyway (Joomla 1.5), and Protostar (Joomla 3.0).

This template is a customized fork of the Cassiopeia template introduced in Joomla 4, preserving its modern, accessible, and mobile-first foundation while introducing new stylistic enhancements and structural refinements specifically tailored for use by Moko Consulting.

Code Attribution

This template is based on the original Cassiopeia template developed by the Joomla! Project and released under the GNU General Public License.

Modifications and enhancements have been made by Moko Consulting in accordance with open-source licensing standards.

It includes integration with Bootstrap TOC, an open-source table of contents generator by A. Feld, licensed under the MIT License.

All third-party libraries and assets remain the property of their respective authors and are credited within their source files where applicable.

" ; ===== System / layout ===== -TPL_MOKO-CASSIOPEIA_DEVELOPMENTMODE_LABEL="Development Mode" -TPL_MOKO-CASSIOPEIA_DEVELOPMENTMODE_DESC="When enabled, uses non-minified CSS/JS assets for easier debugging. When disabled, automatically creates and uses minified versions for better performance. Switching modes will automatically create or delete .min files as needed." +TPL_MOKO-CASSIOPEIA_DEVELOPMENTMODE_LABEL="Development Mode (Deprecated)" +TPL_MOKO-CASSIOPEIA_DEVELOPMENTMODE_DESC="This setting is deprecated. Asset minification is now controlled by Joomla's cache system (System > Global Configuration > System > Cache Settings). When cache is enabled, minified assets are used. When cache is disabled, non-minified assets are used for debugging." TPL_MOKO-CASSIOPEIA_FLUID_LABEL="Layout" TPL_MOKO-CASSIOPEIA_STATIC="Static" TPL_MOKO-CASSIOPEIA_FLUID="Fluid" diff --git a/src/templates/AssetMinifier.php b/src/templates/AssetMinifier.php index d3bd241..0b82f22 100644 --- a/src/templates/AssetMinifier.php +++ b/src/templates/AssetMinifier.php @@ -11,7 +11,7 @@ REPO: https://github.com/mokoconsulting-tech/moko-cassiopeia PATH: ./templates/moko-cassiopeia/AssetMinifier.php VERSION: 03.08.00 - BRIEF: Asset minification helper for development mode toggle + BRIEF: Asset minification helper linked to Joomla cache system */ defined('_JEXEC') or die; @@ -20,10 +20,10 @@ defined('_JEXEC') or die; * Asset Minifier Helper * * Handles minification and cleanup of CSS and JavaScript assets - * based on the development mode setting. + * based on the Joomla cache system setting. * * IMPORTANT NOTES: - * - This is a BASIC minifier suitable for development/production switching + * - This is a BASIC minifier suitable for cache-based switching * - For production builds, consider using professional tools like: * * CSS: cssnano, clean-css * * JavaScript: terser, uglify-js, closure-compiler @@ -32,7 +32,11 @@ defined('_JEXEC') or die; * - 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. + * based on Joomla's cache setting, not for optimal compression. + * + * BEHAVIOR: + * - When Joomla cache is ENABLED: Uses minified (.min) files for performance + * - When Joomla cache is DISABLED: Uses non-minified files for debugging */ class AssetMinifier { @@ -157,16 +161,19 @@ class AssetMinifier } /** - * Process assets based on development mode + * Process assets based on cache setting + * + * When $useNonMinified is true (cache disabled), deletes .min files and uses source files + * When $useNonMinified is false (cache enabled), creates .min files and uses them * * @param string $mediaPath Path to media directory - * @param bool $developmentMode Development mode flag + * @param bool $useNonMinified Whether to use non-minified files (true when cache disabled) * @return array Status information */ - public static function processAssets(string $mediaPath, bool $developmentMode): array + public static function processAssets(string $mediaPath, bool $useNonMinified): array { $result = [ - 'mode' => $developmentMode ? 'development' : 'production', + 'mode' => $useNonMinified ? 'cache-disabled' : 'cache-enabled', 'minified' => 0, 'deleted' => 0, 'errors' => [] @@ -177,11 +184,11 @@ class AssetMinifier return $result; } - if ($developmentMode) { - // Delete all .min files + if ($useNonMinified) { + // Cache disabled: Delete all .min files and use non-minified sources $result['deleted'] = self::deleteMinifiedFiles($mediaPath); } else { - // Create minified versions of CSS and JS files + // Cache enabled: Create minified versions of CSS and JS files for performance // 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. diff --git a/src/templates/index.php b/src/templates/index.php index 6ade083..dd6ee92 100644 --- a/src/templates/index.php +++ b/src/templates/index.php @@ -42,11 +42,15 @@ $params_googleanalytics = $this->params->get('googleanalytics', false); $params_googleanalyticsid = $this->params->get('googleanalyticsid', null); $params_custom_head_start = $this->params->get('custom_head_start', null); $params_custom_head_end = $this->params->get('custom_head_end', null); -$params_developmentmode = $this->params->get('developmentmode', false); -// Process assets based on development mode +// Check if Joomla cache is enabled (use minified assets when cache is on) +$cacheEnabled = (bool) $app->get('caching', 0); + +// Process assets based on cache setting +// When cache is enabled, use minified assets for performance +// When cache is disabled, use non-minified assets for debugging $mediaPath = JPATH_ROOT . '/media/templates/site/moko-cassiopeia'; -AssetMinifier::processAssets($mediaPath, $params_developmentmode); +AssetMinifier::processAssets($mediaPath, !$cacheEnabled); // Bootstrap behaviors (assets handled via WAM) HTMLHelper::_('bootstrap.framework'); @@ -87,8 +91,10 @@ $this->setTitle($final); // Template/Media path $templatePath = 'media/templates/site/moko-cassiopeia'; -// Asset suffix based on development mode -$assetSuffix = $params_developmentmode ? '' : '.min'; +// Asset suffix based on Joomla cache setting +// When cache is enabled, use minified (.min) files for performance +// When cache is disabled, use non-minified files for debugging +$assetSuffix = $cacheEnabled ? '.min' : ''; // =========================== // Web Asset Manager (WAM) — matches your joomla.asset.json diff --git a/src/templates/offline.php b/src/templates/offline.php index 8640e3d..cac392c 100644 --- a/src/templates/offline.php +++ b/src/templates/offline.php @@ -41,14 +41,17 @@ $params = $this->params ?: $app->getTemplate(true)->params; $direction = $this->direction ?: 'ltr'; /* ----------------------- - Load ONLY template.css + colors_*.css (with min toggle) + Load ONLY template.css + colors_*.css (with min toggle based on cache) ------------------------ */ -$developmentMode = (int) $params->get('developmentmode', 0) === 1; -$assetSuffix = $developmentMode ? '' : '.min'; +// Check if Joomla cache is enabled (use minified assets when cache is on) +$cacheEnabled = (bool) $app->get('caching', 0); +$assetSuffix = $cacheEnabled ? '.min' : ''; -// Process assets based on development mode +// Process assets based on cache setting +// When cache is enabled, use minified assets for performance +// When cache is disabled, use non-minified assets for debugging $mediaPath = JPATH_ROOT . '/media/templates/site/moko-cassiopeia'; -AssetMinifier::processAssets($mediaPath, $developmentMode); +AssetMinifier::processAssets($mediaPath, !$cacheEnabled); $base = rtrim(Uri::root(true), '/') . '/media/templates/site/moko-cassiopeia/css/';