protonemedia / laravel-splade

💫 The magic of Inertia.js with the simplicity of Blade 💫 - Splade provides a super easy way to build Single Page Applications (SPA) using standard Laravel Blade templates, and sparkle it to make it interactive. All without ever leaving Blade.
https://splade.dev
MIT License
1.47k stars 112 forks source link

Component Specific Javascript Dependencies #545

Closed KimGrimm closed 8 months ago

KimGrimm commented 10 months ago

Description:

It seem's to me that we don't have a good and easy way to load custom javascript Dependencies for every page specific. What i've found in the internet is always a sneak-around solution and doesn't feel great, if it's even working..

What I mean get's clear when you think of a theme with multiple pages. Every Page has some charts and statistics on it. The theme provides 3rd-Party-Libraries for that and uses it in the demo files of the theme. So far so good. But when i swap it from basic HTML to Splade it contains page-specific javascript dependencies which don't get "re-loaded" or "re-initialized" during the seamlease pageload of splade.

The script component doesn't provide any feature for external scripts i just want to embed into the specific page. Sadly there is no "default scripts" or something where we could simply pass an array of script-href's to the view method in the controller which are provided with the template of the splade component and them being rendered after the template is mounted.

Do i make sens in someway? Please be kind. I am a newbie to splade but i love it so far. This is my only error it seems i cant solve.

Steps To Reproduce Issue:

dwicahyo1512 commented 9 months ago

same problem @pascalbaljet

bardolf69 commented 9 months ago

try including the javascript in a <x-splade-script></x-splade-script> block. https://splade.dev/docs/x-script

pascalbaljet commented 8 months ago

Please reopen the issue with steps to reproduce.