From 370cf7dfc5a0fba476740054b1d9ea29f2fd9665 Mon Sep 17 00:00:00 2001 From: Mathieu Hamonic Date: Wed, 10 Jul 2013 15:56:32 +0200 Subject: [PATCH] Make sure casset renders each file only once --- classes/casset.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/classes/casset.php b/classes/casset.php index 2e9e808..f90a8af 100644 --- a/classes/casset.php +++ b/classes/casset.php @@ -1069,6 +1069,7 @@ protected static function files_to_render($type, $group) // Add it to the list of rendered groups array_push(static::$rendered_groups[$type], $group_name); + $added = array(); foreach (static::$groups[$type][$group_name]['files'] as $file_set) { if (static::$groups[$type][$group_name]['min']) @@ -1081,10 +1082,14 @@ protected static function files_to_render($type, $group) $assets = static::find_files($file_set[0], $type); } foreach ($assets as $file) { - array_push($files[$group_name], array( - 'file' => $file, - 'minified' => $minified, - )); + if (!in_array($file, $added)) + { + array_push($files[$group_name], array( + 'file' => $file, + 'minified' => $minified, + )); + $added[] = $file; + } } } }