From 48b90e86b6857aada23e158a7c83008f38116150 Mon Sep 17 00:00:00 2001 From: Samuel Georges Date: Sat, 6 Dec 2014 13:43:06 +1100 Subject: [PATCH] Config item `cms.enableAssetMinify` can now be set to **null**, in which case assets are only minified if debug mode (`app.debug`) is disabled. --- CHANGELOG.md | 1 + app/config/cms.php | 7 ++++--- modules/system/classes/CombineAssets.php | 8 ++++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 16910ec97..97b34513c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ * **Build 16x** (2014-12-xx) - Config item `cms.customErrorPage` is deprecated, the setting `app.debug` should be used instead. + - Config item `cms.enableAssetMinify` can now be set to **null**, in which case assets are only minified if debug mode (`app.debug`) is disabled. * **Build 167** (2014-12-06) - Settings pages now have a *Reset to default* button. diff --git a/app/config/cms.php b/app/config/cms.php index ba93e8722..b792ce3d2 100644 --- a/app/config/cms.php +++ b/app/config/cms.php @@ -131,12 +131,13 @@ return array( |-------------------------------------------------------------------------- | | If the minification is enabled, combined assets are compressed (minified). - | It is recommended to disable the minification during the development, and - | enable it in the production mode. + | It is recommended to disable the minification during development, and + | enable it in production mode. If set to null, assets are minified + | when debug mode (app.debug) is disabled. | */ - 'enableAssetMinify' => false, + 'enableAssetMinify' => null, /* |-------------------------------------------------------------------------- diff --git a/modules/system/classes/CombineAssets.php b/modules/system/classes/CombineAssets.php index cfc126ee0..1c94fc784 100644 --- a/modules/system/classes/CombineAssets.php +++ b/modules/system/classes/CombineAssets.php @@ -75,10 +75,14 @@ class CombineAssets public function __construct() { /* - * Register cache preference + * Register preferences */ $this->useCache = Config::get('cms.enableAssetCache', false); - $this->useMinify = Config::get('cms.enableAssetMinify', false); + $this->useMinify = Config::get('cms.enableAssetMinify', null); + + if ($this->useMinify === null) { + $this->useMinify = !Config::get('app.debug', false); + } /* * Register JavaScript filters