JavaScript: Ensure that `$baseFiles` are loaded first if minified
This commit is contained in:
parent
b4531b6b45
commit
59e6ec4035
|
@ -153,8 +153,9 @@ class JavaScript
|
|||
$out .= ';' . ltrim(trim(file_get_contents($file)), ';') . "\n";
|
||||
}
|
||||
|
||||
$baseJs = '';
|
||||
foreach ($baseFiles as $file) {
|
||||
$js .= file_get_contents($file) . "\n\n\n";
|
||||
$baseJs .= file_get_contents($file) . "\n\n\n";
|
||||
}
|
||||
|
||||
if (! $forIe11) {
|
||||
|
@ -202,9 +203,11 @@ class JavaScript
|
|||
|
||||
if ($minified) {
|
||||
require_once 'JShrink/Minifier.php';
|
||||
$out .= Minifier::minify($js, array('flaggedComments' => false));
|
||||
$out .= Minifier::minify($js, ['flaggedComments' => false]);
|
||||
$baseOut = Minifier::minify($baseJs, ['flaggedComments' => false]);
|
||||
$out = ';' . ltrim($baseOut, ';') . "\n" . $out;
|
||||
} else {
|
||||
$out .= $js;
|
||||
$out = $baseJs . $out . $js;
|
||||
}
|
||||
|
||||
$cache->store($cacheFile, $out);
|
||||
|
|
Loading…
Reference in New Issue