peterdickins's avatar

Page specific javascript and webpack

Hi,

I have javascript files that are only required on some pages, if there are included in other pages then they cause console errors.

Should I include these files in app.js for compiling assets with Laravel Mix or just put the in public/js manually and include them in my blade templates where required?

0 likes
2 replies
jlrdw's avatar

Or make a separate custom.js compile. Either way should work for you.

snake03's avatar

I would suggest the latter.

You can compile them separately if you want (to minify them) and include them in the appropriate views. You can use the @push and @stack functions of blade in your views and layouts.

1 like

Please or to participate in this conversation.