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

Hans Christian Rodríguez on "[Plugin: Autoptimize] [Suggest] CSS on the footer"

$
0
0

Hallo Frank!

First of all, thanks for developing this GREAT plugin :D

I want to suggest you a new feature: what about to add an extra option to include the compressed stylesheet in a JS script in the footer?

I just discovered this option in this website and I noticed that this site loads the main CSS on the footer! That's the code on the front-end:

<script>
 var cb = function() {
 var l = document.createElement('link'); l.rel = 'stylesheet';
 l.href = 'http://www.vesperhotel.com/wp-content/themes/vesperhotel/css/vesperhotel.min.css';
 var h = document.getElementsByTagName('head')[0]; h.parentNode.insertBefore(l, h);
 };
 var raf = requestAnimationFrame || mozRequestAnimationFrame ||
 webkitRequestAnimationFrame || msRequestAnimationFrame;
 if (raf) raf(cb);
 else window.addEventListener('load', cb);
</script>
<noscript>
 <link rel="stylesheet" href="http://www.vesperhotel.com/wp-content/themes/vesperhotel/css/vesperhotel.min.css" />
</noscript>

It helps to increase the score for Google Pagespeed. Now I'm adding this code by hand on my child themes on the footer.php file. But it will be great to use this feature with AO.

Thanks for hearing!

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


Viewing all articles
Browse latest Browse all 14038

Trending Articles