Commit c11ca087 by Alexander Makarov

Fixed asset controller tests

parent d84898a7
...@@ -285,7 +285,7 @@ class AssetController extends Controller ...@@ -285,7 +285,7 @@ class AssetController extends Controller
*/ */
protected function buildTarget($target, $type, $bundles) protected function buildTarget($target, $type, $bundles)
{ {
$tempFile = strtr($target->$type, ['{hash}' => 'temp']); $tempFile = $target->basePath . '/' . strtr($target->$type, ['{hash}' => 'temp']);
$inputFiles = []; $inputFiles = [];
foreach ($target->depends as $name) { foreach ($target->depends as $name) {
...@@ -298,12 +298,12 @@ class AssetController extends Controller ...@@ -298,12 +298,12 @@ class AssetController extends Controller
} }
} }
if ($type === 'js') { if ($type === 'js') {
$this->compressJsFiles($inputFiles, $target->basePath . '/' . $tempFile); $this->compressJsFiles($inputFiles, $tempFile);
} else { } else {
$this->compressCssFiles($inputFiles, $target->basePath . '/' . $tempFile); $this->compressCssFiles($inputFiles, $tempFile);
} }
$outputFile = strtr($target->$type, ['{hash}' => md5_file($tempFile)]); $outputFile = $target->basePath . '/' . strtr($target->$type, ['{hash}' => md5_file($tempFile)]);
rename($tempFile, $outputFile); rename($tempFile, $outputFile);
$target->$type = [$outputFile]; $target->$type = [$outputFile];
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment