diff options
author | Sam Light <sam@lightscale.co.uk> | 2025-03-31 01:08:16 +0100 |
---|---|---|
committer | Sam Light <samlight1994@gmail.com> | 2025-03-31 01:08:16 +0100 |
commit | a56a167ac5e5384810a980f97e71b182ce7a98a2 (patch) | |
tree | 3d167725c804002a77dfdff3d2d8176ba98d6995 | |
parent | 53bf2ca6ac05d5102d2afbf163c94301abb70c03 (diff) |
Setup components to output assets
-rw-r--r-- | resources/views/components/footer.blade.php | 1 | ||||
-rw-r--r-- | resources/views/components/head.blade.php | 1 | ||||
-rw-r--r-- | src/AssetsServiceProvider.php | 16 |
3 files changed, 18 insertions, 0 deletions
diff --git a/resources/views/components/footer.blade.php b/resources/views/components/footer.blade.php new file mode 100644 index 0000000..7cfc4fc --- /dev/null +++ b/resources/views/components/footer.blade.php @@ -0,0 +1 @@ +@inject('assets', 'Lightscale\LaralightAssets\Assets') diff --git a/resources/views/components/head.blade.php b/resources/views/components/head.blade.php new file mode 100644 index 0000000..7cfc4fc --- /dev/null +++ b/resources/views/components/head.blade.php @@ -0,0 +1 @@ +@inject('assets', 'Lightscale\LaralightAssets\Assets') diff --git a/src/AssetsServiceProvider.php b/src/AssetsServiceProvider.php index ba97e21..9e1d40d 100644 --- a/src/AssetsServiceProvider.php +++ b/src/AssetsServiceProvider.php @@ -6,7 +6,23 @@ use Illuminate\Support\ServiceProvider; class AssetsServiceProvider extends ServiceProvider { + public const NAMESPACE = 'laralight-assets'; + public $singletons = [ Assets::class ]; + + public function boot(): void + { + $ns = static::NAMESPACE; + $root = __DIR__ . '/../'; + $viewsPath = $root . 'resources/views'; + + $this->loadViewsFrom($viewsPath, $ns); + + $this->publishes([ + $viewsPath => resource_path("views/vendor/{$ns}"), + ]); + } + } |