maj
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
/**
|
||||
* @package Grav\Common\Assets\Traits
|
||||
*
|
||||
* @copyright Copyright (c) 2015 - 2021 Trilby Media, LLC. All rights reserved.
|
||||
* @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved.
|
||||
* @license MIT License; see LICENSE file for details.
|
||||
*/
|
||||
|
||||
@@ -62,13 +62,13 @@ trait AssetUtilsTrait
|
||||
* Download and concatenate the content of several links.
|
||||
*
|
||||
* @param array $assets
|
||||
* @param bool $css
|
||||
* @param int $type
|
||||
* @return string
|
||||
*/
|
||||
protected function gatherLinks(array $assets, $css = true)
|
||||
protected function gatherLinks(array $assets, int $type = self::CSS_ASSET): string
|
||||
{
|
||||
$buffer = '';
|
||||
foreach ($assets as $id => $asset) {
|
||||
foreach ($assets as $asset) {
|
||||
$local = true;
|
||||
|
||||
$link = $asset->getAsset();
|
||||
@@ -100,21 +100,25 @@ trait AssetUtilsTrait
|
||||
}
|
||||
|
||||
// Double check last character being
|
||||
if (!$css) {
|
||||
if ($type === self::JS_ASSET || $type === self::JS_MODULE_ASSET) {
|
||||
$file = rtrim($file, ' ;') . ';';
|
||||
}
|
||||
|
||||
// If this is CSS + the file is local + rewrite enabled
|
||||
if ($css && $this->css_rewrite) {
|
||||
if ($type === self::CSS_ASSET && $this->css_rewrite) {
|
||||
$file = $this->cssRewrite($file, $relative_dir, $local);
|
||||
}
|
||||
|
||||
if ($type === self::JS_MODULE_ASSET) {
|
||||
$file = $this->jsRewrite($file, $relative_dir, $local);
|
||||
}
|
||||
|
||||
$file = rtrim($file) . PHP_EOL;
|
||||
$buffer .= $file;
|
||||
}
|
||||
|
||||
// Pull out @imports and move to top
|
||||
if ($css) {
|
||||
if ($type === self::CSS_ASSET) {
|
||||
$buffer = $this->moveImports($buffer);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user