Registering asset in plugin
I am building a plugin which adds all agenda related views. I need some javascript for the headers to work and I am registering it in my plugin provider.
However it says that the resource is not found in the network tab in the browser. It is showing up in the tree of html elements but I am doing something wrong with specifying the path to the resource.
Help would really be appreciated!
3 Replies
php artisan filament:assets
The script has to be published by filament. This normally runs when installing the plugin or composer update.
thank you very much!
I have now also found an alternative solution by checking out some other plugins.
They have a scripts view in their view resources and then do @include(static::$scriptsView) which also loads the script.
What is the better method of loading the script?
It does now correctly work if I dont specify the loadOnRequest() However when I add this it errors out on maximum tries
The docs cover this. But I wouldn’t say there’s a best way.
https://filamentphp.com/docs/3.x/support/assets#registering-javascript-files