Importing Custom JavaScript Files
Directory Structure
Your custom JavaScript files are stored in the js folder located within the _includes directory. This structure helps in organizing your JavaScript code efficiently.
Steps to Import New JavaScript Files
Create Your Custom JavaScript File:
- Navigate to the js folder within the _includes directory.
- Create a new JavaScript file. For example, myCustomScript.js.
- Add your JavaScript code to this file.
Import the Custom File in main.js:
- The main.js file acts as the entry point for JavaScript in this project.
- To include your custom script, open the main.js file located in the same js folder.
- At the top of main.js, add the import statement for your new file. For instance:
import './myCustomScript';
Ensure the path is relative to the location of main.js.