Quantcast
Channel: WordPress.org Forums » [Autoptimize] Support
Viewing all articles
Browse latest Browse all 14094

futtta on "[Plugin: Autoptimize] Change location of optimized files in the head (specifically JS)"

$
0
0

Currently the <title>-tag is used to inject CSS (before) and </head>-tag for JS (injected after), while the inline CSS/JS is left as is, which indeed would block execution of inline script in head until the external resource is loaded.

To fix this, you could use the autoptimize_filter_js_defer filter to force the script in head to be async (which might or might not break some of your JS).

If that does not work you could open up wp-content/plugins/autoptimize/autoptimizeScripts.php and on line 211 change

$replaceTag="</head>";

into

$replaceTag="</title>";

I could, in a next version, include filters in the API to override the defaults;
autoptimize_filter_js_replacetag
autoptimize_filter_css_replacetag

hope this helps,
frank


Viewing all articles
Browse latest Browse all 14094

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>