Support » Plugin: Autoptimize » 8GB of JS files, Jetpack to blame?

  • Resolved pixeldynamo

    (@pixeldynamo)


    So we upgraded Jetpack before the weekend (and the subsequent 3.4.1 release) and thought all was well until AutoOptimize almost ran out of disk space, having generated 8GB of JS files.

    Comparing the files, only one thing appears to differ, code which references WordPress stats. AutoOptimize appears to be pulling in the content of //stats.wp.com/e-201513.js which contains an incrementing value.

    I would ideally like to exclude this file and have tried adding e-201513.js, stats.wp.com/e-201513.js and http//stats.wp.com/e-201513.js to the advanced options for javascript to no avail.

    Any idea what the correct syntax might be? Reading the blog post it suggests the above should be enough.

    https://wordpress.org/plugins/autoptimize/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Frank Goossens

    (@futtta)

    That’s very weird pixeldynamo; AO never aggregates/ minifies external files. Are you 100% sure that file is moved to the aggregated JS-file?

    frank

    Thread Starter pixeldynamo

    (@pixeldynamo)

    Both sets of strings from the js file match the jetpack script, I can’t find them anywhere else.

    I can email samples or the entire files if useful.

    Plugin Author Frank Goossens

    (@futtta)

    just had a look at the HTML of your homepage, the stats-code is still in there:

    <script type='text/javascript' src='//stats.wp.com/e-201513.js' async defer></script>

    so that is no the issue, but I now indeed see that the inline stats-code is migrated to the autoptimized JS;

    <script type='text/javascript'>
    	_stq = window._stq || [];
    	_stq.push([ 'view', {v:'ext',j:'1:3.4.1',blog:'60484059',post:'962',tz:'0'} ]);
    	_stq.push([ 'clickTrackerInit', '60484059', '962' ]);
    </script>

    and that indeed will result in an important amount of autoptimized JS-files. to avoid this, add “_stq” to the comma-seperated exclusion list. I’ll make sure this gets exluded by default in the next release.

    frank

    Thread Starter pixeldynamo

    (@pixeldynamo)

    I’ve excluded _stq but still generating a lot of files, how many are reasonable to expect?

    Plugin Author Frank Goossens

    (@futtta)

    Depends on your context really (one could expect different page types to have different JS, so each page type could easily have it’s own autoptimized file). let’s say that anything below 100 js-files seems like normal behavior.

    I’ve compared the HTML of 2 “features”-blogposts and at least those 2 refer to the same aggergated JS-file (http://3m6ok5roj7q1lfxor15yilh164s.wpengine.netdna-cdn.com/wp-content/cache/autoptimize/js/autoptimize_3bf91e48539bd79953692bae2cba6dac.js), so that’s a first indication there is reuse of the same file across different pages (blogposts).

    frank

    Thread Starter pixeldynamo

    (@pixeldynamo)

    Up to 105 (JS) already in five hours of a total of 142 files.

    Plugin Author Frank Goossens

    (@futtta)

    well, try to find which pages don’t server the exact same JS-file, once you have identified that you can see what the differences between those are (cfr. the approach taken in this post from earlier today) and exclude accordingly.

    alternatively you could disable inline JS from being aggregated, which will 99,99999% sure solve this in one swift swoop (but which will exclude all inline JS from being aggregated) by adding something like this in a plugin or a (child) theme’s functions.php;

    add_filter('autoptimize_js_include_inline','pixeldynamo_ao_js_include_inline',10,1);
    function pixeldynamo_ao_js_include_inline() {
    	return false;
    	}

    frank

    Thread Starter pixeldynamo

    (@pixeldynamo)

    Up to 242 now, a big improvement on before but there’s obviously something we still need to identify.

    Plugin Author Frank Goossens

    (@futtta)

    ok, feel free to update this thread as you solve this.

    frank

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘8GB of JS files, Jetpack to blame?’ is closed to new replies.