Skip to content

Commit a039b7d

Browse files
committed
Param tempPath is taken right [Fixes #120]
- When tempPath was set in neon in JS and CSS section, first occurrence was overwritten by last occurrence.
1 parent b233e2d commit a039b7d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

WebLoader/Nette/Extension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function loadConfiguration()
8888
foreach ($config[$type] as $name => $wlConfig) {
8989
$wlConfig = Helpers::merge($wlConfig, $config[$type . 'Defaults']);
9090
$this->addWebLoader($builder, $type . ucfirst($name), $wlConfig);
91-
$loaderFactoryTempPaths[strtolower($name)] = $wlConfig['tempPath'];
91+
$loaderFactoryTempPaths[$type][strtolower($name)] = $wlConfig['tempPath'];
9292

9393
if (!is_dir($wlConfig['tempDir']) || !is_writable($wlConfig['tempDir'])) {
9494
throw new CompilationException(sprintf("You must create a writable directory '%s'", $wlConfig['tempDir']));

WebLoader/Nette/LoaderFactory.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function createCssLoader($name)
4343
{
4444
/** @var Compiler $compiler */
4545
$compiler = $this->serviceLocator->getService($this->extensionName . '.css' . ucfirst($name) . 'Compiler');
46-
return new CssLoader($compiler, $this->formatTempPath($name));
46+
return new CssLoader($compiler, $this->formatTempPath('css', $name));
4747
}
4848

4949
/**
@@ -54,17 +54,17 @@ public function createJavaScriptLoader($name)
5454
{
5555
/** @var Compiler $compiler */
5656
$compiler = $this->serviceLocator->getService($this->extensionName . '.js' . ucfirst($name) . 'Compiler');
57-
return new JavaScriptLoader($compiler, $this->formatTempPath($name));
57+
return new JavaScriptLoader($compiler, $this->formatTempPath('js', $name));
5858
}
5959

6060
/**
6161
* @param string $name
6262
* @return string
6363
*/
64-
private function formatTempPath($name)
64+
private function formatTempPath($type, $name)
6565
{
6666
$lName = strtolower($name);
67-
$tempPath = isset($this->tempPaths[$lName]) ? $this->tempPaths[$lName] : Extension::DEFAULT_TEMP_PATH;
67+
$tempPath = isset($this->tempPaths[$type][$lName]) ? $this->tempPaths[$type][$lName] : Extension::DEFAULT_TEMP_PATH;
6868
return rtrim($this->httpRequest->getUrl()->basePath, '/') . '/' . $tempPath;
6969
}
7070

0 commit comments

Comments
 (0)