Moving js files to footer

Hi there,

I have a question about moving my js files. I run a learning management system and I have 50 javascript files loading in the header. I was hoping that Hummingbird would take out some of the manual work for me. It looks to me, though, that everything is still loading in the header, even though it is combining and minifying files. Could I get some advice.

Thanks - Tamara

  • Adam Czajczyk

    Hello Tamara,

    I hope you're doing fine today!

    The Hummingbird plugin does not automatically move all resources to the footer (though it usually is beneficial) because it could cause site to break in many cases. There's however no way to know upfront about it and it would be extremely difficult (if possible at all) to analyze dependencies of these scripts to automatically find out which of them should be moved.

    You do not need however to move the scripts manually one by one. I'd suggest following course of action:

    1. Go to the "Hummingbird -> Minification" page
    2. In a "Search files" text field type just "js"; this will filter out all CSS files leaving only JS
    3. Switch the "Position" switch on the right (see screenshot below) to "Footer" position and save changes.

    This will move all the JS files that are available to Hummingbird to the footer. You will however want to clear all caches on the site and in browser after that and examine the site to make sure whether it's still working well or if it breaks at some areas.

    Next step is to move some selected files back to original position and this can be done by switching the "Position" switch next to each of the file back to "Original" (and saving changes). This is the "hard part" because you'd probably need to call your intuition on which files to move back and also it may take a bit of time to "try and test" these settings. In the end though it should result with as many files moved to the footer as possible.

    Best regards,