Currently, I am developing a large javascript application which functions as a single page application. My technology stack includes node.js with jade. I have some concerns regarding the loading of javascript files for the front end.
Let's say we have the following pages:
- profile
- dashboard
- setting
Should I only load profile.js when the user visits the profile page? Each page is a child of a layout.html containing the header and footer. Loading all scripts on the home page would make it too bulky.
However, I'm not sure if placing my javascript at the bottom of each html file is the right approach. The same applies to my css files. Would appreciate any insights on this matter!