From a03a76ee52c64c435a4dbb2fe840436def7042c9 Mon Sep 17 00:00:00 2001 From: Rike-cz Date: Sun, 23 Sep 2018 22:38:59 +0200 Subject: [PATCH] Finish implementing localPath in combineToFile (#3727) Fixes #3721. Credit to @Rike-cz --- modules/system/classes/CombineAssets.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/modules/system/classes/CombineAssets.php b/modules/system/classes/CombineAssets.php index 34dceea32..72b158572 100644 --- a/modules/system/classes/CombineAssets.php +++ b/modules/system/classes/CombineAssets.php @@ -205,6 +205,17 @@ class CombineAssets // Disable cache always $this->storagePath = null; + // Prefix all assets + if ($localPath) { + if (substr($localPath, -1) !== '/') { + $localPath = $localPath.'/'; + } + $assets = array_map(function($asset) use ($localPath) { + if (substr($asset, 0, 1) === '@') return $asset; + return $localPath.$asset; + }, $assets); + } + list($assets, $extension) = $this->prepareAssets($assets); $rewritePath = File::localToPublic(dirname($destination));