Updated bundle extension

This commit is contained in:
markseu 2019-03-26 10:01:21 +01:00
parent a65ab2d084
commit b1e5b153df
2 changed files with 2 additions and 9 deletions

View file

@ -4,14 +4,13 @@
// This file may be used and distributed under the terms of the public license.
class YellowBundle {
const VERSION = "0.8.3";
const VERSION = "0.8.4";
const TYPE = "feature";
public $yellow; //access to API
// Handle initialisation
public function onLoad($yellow) {
$this->yellow = $yellow;
$this->yellow->system->setDefault("bundleAndMinify", "1");
}
// Handle page output data
@ -69,7 +68,7 @@ class YellowBundle {
array_push($dataOther, $line);
}
}
if ($this->yellow->system->get("bundleAndMinify")) {
if (!defined("DEBUG") || DEBUG==0) {
$dataCss = $this->processBundle($dataCss, "css");
$dataScript = $this->processBundle($dataScript, "js");
}
@ -113,17 +112,12 @@ class YellowBundle {
$fileDataNew .= "/* ".basename($fileName)." */\n";
$fileDataNew .= $fileData;
}
if (defined("DEBUG") && DEBUG>=2) {
if (!empty($fileDataNew)) $fileDataNew .= "\n\n";
$fileDataNew .= "/* YellowBundle::processBundle file:$fileNameBundle <- ".$this->yellow->page->fileName." */";
}
if (is_file($fileNameBundle)) $this->yellow->toolbox->deleteFile($fileNameBundle);
if (!$this->yellow->toolbox->createFile($fileNameBundle, $fileDataNew) ||
!$this->yellow->toolbox->modifyFile($fileNameBundle, $modified)) {
$this->yellow->page->error(500, "Can't write file '$fileNameBundle'!");
}
}
if (defined("DEBUG") && DEBUG>=2) $data["debug"] = "YellowBundle::processBundle file:$fileNameBundle<br/>\n";
}
return $data;
}

View file

@ -51,7 +51,6 @@ UpdateVersionFile: version.ini
UpdateWaffleFile: waffle.ini
UpdateNotification: none
BundleAndMinify: 1
EditLocation: /edit/
EditUploadNewLocation: /media/@group/@filename
EditUploadExtensions: .gif, .jpg, .pdf, .png, .svg, .tgz, .zip