Exclude specific pages from JS asset registration
Anyone know how to exclude a couple of pages when registering a JS asset? I need this script running in the background on 99% of pages so I'm not sure that lazy loading is the right approach...
Solution:Jump to solution
As an example:
```php
if (! function_exists('is_panel_auth_route')) {
function is_panel_auth_route(): bool...
7 Replies
Bump
you can either inline it with a renderhook and scope or with the asset manager https://filamentphp.com/docs/3.x/support/assets#lazy-loading-javascript
Problem is this is something I need on every page except login and register. I couldn't see a simple way of doing that with render hooks. I guess I could use an empty div to lazy load it and use @if to exclude the script from being include on the login and register routes?
Solution
As an example:
Awesome, thanks!
Request::path() in
boot()
was always returning /
(probably because of Octane) so ended up doing it middleware.