Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why are these changes introduced?
Bundling + changing the positions of a few JS files to be picked up earlier by the browser.
What approach did you take?
Since the JS is deferred, we can put them higher up in the document without them negatively affecting the loading of other files. We can also bundle the JS a bit tighter - removing
variants.js
andslider.js
and putting them, instead, intoglobal.js
to remove some network requests.JS that has the
defer
attribute will download when it's found in the DOM at low priority, so it won't block the loading of more critical resources, and it will only run after the critical render path is done. By putting the references to these files higher up, we can benefit from them being picked up sooner by the browser and ensure they're ready to go when the rest of the critical path is done downloading.https://blog.bluetriangle.com/js-delivery-optimization-for-web-performance
Checklist