Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/Nette/WebLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use WebLoader\Compiler;
use WebLoader\Enum\RenderMode;
use WebLoader\File;
use WebLoader\FileCollection;

/**
* Web loader
Expand Down Expand Up @@ -78,7 +79,16 @@ protected function getUrl(File $file): string
*/
public function render(): void
{
$file = $this->compiler->generate();
$hasArgs = func_num_args() > 0;

if ($hasArgs) {
$backup = $this->compiler->getFileCollection();
$newFiles = new FileCollection($backup->getRoot());
$newFiles->addFiles(func_get_args());
$this->compiler->setFileCollection($newFiles);
}

$file = $this->compiler->generate();

if ($file === null) {
return;
Expand All @@ -91,6 +101,10 @@ public function render(): void
};

echo $output, PHP_EOL;

if ($hasArgs) {
$this->compiler->setFileCollection($backup);
}
}


Expand Down