Monday, 27 July 2020

Correct way to load javascript files in Nodejs

I am using ejs. I have a partials called header.ejs and footer.ejs.The footer page looks something like this: //My scripts ........This header and footer template is used in all of my pages like:home page:<% include ./partials/header.ejs %> // HOME CONTENT <% include ./partials/footer.ejs %>Buy items page:<% include ./partials/header.ejs %> // BUY ITEMS CONTENT <% include ./partials/footer.ejs %>and so on. The problem is that now I have about 15 pages and about 25 javascript files. All pages load all javascript files even when most of them only need 3-4 javascript files at max.​Is there a good way to load page specific javascript files?

Submitted July 28, 2020 at 12:56AM by sahilgreen

No comments:

Post a Comment