C
C
coderisimo2016-01-04 14:50:42
WordPress
coderisimo, 2016-01-04 14:50:42

How to deal with JS loading optimization in Wordpress?

I'm trying to learn how to optimize. Goes with a big creak. there is little information, they rarely answer, they advise hiring someone ....
So, the resource https://gtmetrix.com writes the first item in the necessary to optimize the download speed:
639.5KiB of JavaScript is parsed during initial page load. Defer parsing JavaScript to reduce blocking of page rendering.
and then the list:
opty_____.jpg
https://dl.dropboxusercontent.com/u/19954007/asks/... I
take for example, one of the files listed in the list - ..../TweenMax.min.js
I climb into the topic, I find where it connects, I see:

wp_register_script('greensock', bla-bla....TweenMax.min.js', array('greensock_easing'), null, true);

i.e. - php wp_register_script( $handle, $src, $deps, $ver, $in_footer ); we see that the script is connected in the future
, it does not interfere with the loading and rendering of the page.
Explain what else can be done here with this script? I thought that all "optimization analyzers" sleep and see JS in the footer. But is everything ok here? And the rest mentioned https://gtmetrix.com are also in the FOOTHER!
Who is to blame and what to do?
Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
wol_fi, 2016-01-04
@coderisimo

It seems to me that the point here is not where the scripts are, but the fact that they are kilometer-long (hello to twitter a couple of years ago). Still, 639.5KiB is a lot, especially for phones / tablets and mobile Internet. Perhaps some of them can be connected on demand, and not on all pages. Call some of them with scripts (use the same jQuery.getScript, for example).

I
Igor Vorotnev, 2016-01-05
@HeadOnFire

Answer: async, defer . More details here .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question