Skip to content

Commit

Permalink
feat: add noAssets flag
Browse files Browse the repository at this point in the history
  • Loading branch information
BernhardBaumrock committed Mar 30, 2023
1 parent 2b48925 commit c2d0a71
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions RockFrontend.module.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ class RockFrontend extends WireData implements Module, ConfigurableModule
/** @var Manifest */
protected $manifest;

/** @var bool */
public $noAssets = false;

/** @var string */
public $path;

Expand Down Expand Up @@ -200,6 +203,11 @@ function (HookEvent $event) {
$styles = $this->styles();
$scripts = $this->scripts();

// early exit if asset injection is disabled
// Usage: place "$rockfrontend->noAssets = true" somewhere in your
// template file to prevent loading of any rockfrontend assets
if ($this->noAssets) return;

// early exit if html does not contain a head section
if (!strpos($html, "</head>")) return;

Expand Down

0 comments on commit c2d0a71

Please sign in to comment.