Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
VarunAgw Posted December 22, 2022 Posted December 22, 2022 I am owner of the website (it's not a plugin/application). In the past, I added my JS under theme folder and added it in includJs using {resource} But I noticed, it caused 10+ additional requests when someone visits the website. How do I package under my JS with invision resource to avoid extra network requests?
Jim M Posted December 22, 2022 Posted December 22, 2022 Every file you include on the page will initiate a network request. We do not recommend packaging custom Javascript into our own core Javascript. You're best off, if you have multiple Javascript files to include that are your own and being loaded from your server, just put them in as few files as you can and include them into the "Page Output" tab in ACP -> System -> Advanced Configuration, as needed.
VarunAgw Posted December 22, 2022 Author Posted December 22, 2022 3 minutes ago, Jim M said: Every file you include on the page will initiate a network request. We do not recommend packaging custom Javascript into our own core Javascript. You're best off, if you have multiple Javascript files to include that are your own and being loaded from your server, just put them in as few files as you can and include them into the "Page Output" tab in ACP -> System -> Advanced Configuration, as needed. There are multiple files (some are libraries with 1000s of line of code and some is custom code written internally). Merging all of them in a single file manually is not ideal for me. Is it possible to keep thems separate in dev environtment and merge them in a single file automatically in production?
Jim M Posted December 22, 2022 Posted December 22, 2022 5 minutes ago, VarunAgw said: There are multiple files (some are libraries with 1000s of line of code and some is custom code written internally). Merging all of them in a single file manually is not ideal for me. Is it possible to keep thems separate in dev environtment and merge them in a single file automatically in production? That would be up to you how you wish to handle this as it would not be handle via our software.
VarunAgw Posted December 22, 2022 Author Posted December 22, 2022 22 minutes ago, Jim M said: That would be up to you how you wish to handle this as it would not be handle via our software. Ok understood. I just want to ensure I am not missing an existing feature and reinventing the wheel.
Marc Posted December 23, 2022 Posted December 23, 2022 You arent. There is no built in feature to do this other than the area mentioned by my colleague. Other than that, creating an application for that purpose would be the other way to go
Recommended Posts