diff --git a/src/Roots/Acorn/Assets/Bundle.php b/src/Roots/Acorn/Assets/Bundle.php index 29bf00ec..f893beed 100644 --- a/src/Roots/Acorn/Assets/Bundle.php +++ b/src/Roots/Acorn/Assets/Bundle.php @@ -67,7 +67,7 @@ public function css(?callable $callable = null) * * Optionally pass a function to execute on each JS file. * - * @param callable $callable + * @param callable $callable * @return Collection|$this */ public function js(?callable $callable = null) @@ -88,7 +88,7 @@ public function js(?callable $callable = null) } /** - * Get depdencies. + * Get the bundle dependencies. * * @return array */ @@ -98,7 +98,7 @@ public function dependencies() } /** - * Get bundle runtime. + * Get the bundle runtime. * * @return string|null */ @@ -125,6 +125,12 @@ public function runtimeSource() return self::$runtimes[$runtime] = file_get_contents("{$this->path}/{$runtime}"); } + /** + * Get the bundle URL. + * + * @param string $path + * @return string + */ protected function getUrl($path) { if (parse_url($path, PHP_URL_HOST)) { @@ -137,6 +143,11 @@ protected function getUrl($path) return "{$uri}/{$path}"; } + /** + * Set the bundle runtime. + * + * @return void + */ protected function setRuntime() { if (Arr::isAssoc($this->bundle['js'])) { diff --git a/src/Roots/Acorn/Assets/Concerns/Enqueuable.php b/src/Roots/Acorn/Assets/Concerns/Enqueuable.php index 7f431740..534c88d6 100644 --- a/src/Roots/Acorn/Assets/Concerns/Enqueuable.php +++ b/src/Roots/Acorn/Assets/Concerns/Enqueuable.php @@ -155,7 +155,9 @@ public function inlineRuntime() */ public function inline($contents, $position = 'after') { - if (! $handles = array_keys($this->bundle['js'] ?? [])) { + $bundle = array_merge($this->bundle['js'], $this->bundle['mjs']) ?? []; + + if (! $handles = array_keys($bundle)) { return $this; }