Skip to content

Commit

Permalink
Fix error locating default resources when there is no project active
Browse files Browse the repository at this point in the history
  • Loading branch information
drmad committed Oct 27, 2021
1 parent c2b3b26 commit 4493b2c
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions src/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,25 +101,27 @@ public function render(): string
);

// Si hay un CSS con el mismo nombre del método, lo añadimos
$found = $this->resource_locator->find(
$this->project->method,
type: 'css',
ext: ['css', 'scss'],
);
if ($this->project->method) {
$found = $this->resource_locator->find(
$this->project->method,
type: 'css',
ext: ['css', 'scss'],
);

if ($found) {
$html->addCss($this->project->method);
}
if ($found) {
$html->addCss($this->project->method);
}

// Si hay un JS con el mismo nombre del método, lo añadimos
$found = $this->resource_locator->find(
$this->project->method,
type: 'js',
ext: ['js'],
);
// Si hay un JS con el mismo nombre del método, lo añadimos
$found = $this->resource_locator->find(
$this->project->method,
type: 'js',
ext: ['js'],
);

if ($found) {
$html->addJs($this->project->method);
if ($found) {
$html->addJs($this->project->method);
}
}

return $html->render();
Expand Down

0 comments on commit 4493b2c

Please sign in to comment.