Hello I see you there the theme has lots of helpers for loading javascript in various ways.
i'm using Laravel
My first question is where would I put my javascript for single pages.
My second question is where would I put my Java script for app wide use.
Hi,
To load JavaScript files in your Laravel project, you can use the Laravel Mix tool that comes with the starter template. Laravel Mix is a wrapper around Webpack that simplifies the process of compiling and bundling your assets.
There is no fixed rule for where to put your JavaScript files, but you can follow some conventions based on your needs.
- For global JavaScript files that you want to use in every page, you can add them to the `/starterkit/resources/mix/scripts.js` file. This file will be compiled and output to the `public/js` folder. You don't need to include it manually in your Blade layout file, because the starter template already does that.
- For page-specific JavaScript files that you only want to use in certain pages, you can create a separate file for each page and add them to the `/starterkit/resources/mix/vendors` folder. This folder will be copied to the `public/assets/plugins/custom` folder without any compilation. You can then include them in your Controller file using the `addJavascriptFile` helper function, like this:
addJavascriptFile("assets/plugins/custom/my-page.js");