Skip to content
Advertisement

Using stacks in Laravel 8

I’m building a site using Laravel 8 and Jetstream. Jetstream is opinionated about the javascript / css framework, which is great, but I’m needing to add an external javascript library to one of my components, and I don’t see anywhere to add them in the default app layout. So I added a stack for the css /js like this in the default app layout:

JavaScript

Then in my child view that extends the app layout, I’m trying to push the js file to the js stack:

JavaScript

When I view source, the js file isn’t there in the child view. What am I missing? Is this the right way to add custom js / css to Jetstream or is there a better way?

Advertisement

Answer

For anyone banging their head against a similar wall– the problem with my code is that the push needs to be inside the layout tag. Once I moved that up, it worked (and I had been using public_path wrong):

JavaScript

I’ll leave this open in case there’s a better way to accomplish this!

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement