forked from coreshop/Pimcore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathResourceLoader.php
More file actions
41 lines (35 loc) · 1.1 KB
/
Copy pathResourceLoader.php
File metadata and controls
41 lines (35 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
/**
* CoreShop.
*
* This source file is subject to the GNU General Public License version 3 (GPLv3)
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
* files that are distributed with this source code.
*
* @copyright Copyright (c) 2015-2019 Dominik Pfaffenbauer (https://www.pfaffenbauer.at)
* @license https://www.coreshop.org/license GNU General Public License version 3 (GPLv3)
*/
namespace CoreShop\Component\Pimcore;
use Pimcore\Tool\Admin;
final class ResourceLoader
{
/**
* @param array $resources
* @param bool $minify
*
* @return array
*/
public function loadResources($resources, $minify = false)
{
if (PIMCORE_DEVMODE || !$minify) {
return $resources;
}
$scriptContents = '';
foreach ($resources as $scriptUrl) {
if (is_file(PIMCORE_WEB_ROOT . $scriptUrl)) {
$scriptContents .= file_get_contents(PIMCORE_WEB_ROOT . $scriptUrl) . "\n\n\n";
}
}
return [Admin::getMinimizedScriptPath($scriptContents)];
}
}