Following your original post I thought I would take a look at this - as currently I only defer the jscript.
in templates/MY_TEMPLATE/auto_loaders/loader_css.php (create it if it doesn't exist), add this (you can also wrap a conditional statement around this as mentioned in the plugins Readme)
Code:
<?php
$loaders[] = array('conditions' => array('pages' => array ('*')),
'css_files' => array(
'defer/something.css' => array(
'order' => 1,
'defer' => true
)
)
);
?>
and, for example, add something.css to templates/MY_TEMPLATE/css/defer/
then at/near the bottom of your page code you should see the deferred css as:
Code:
<script type="text/javascript" async>
var elm = document.createElement("link");
elm.rel = "stylesheet";
elm.type = "text/css";
elm.href = "min/?f=/includes/templates/MY_TEMPLATE/css/defer/something.css&1570615485";
var links = document.getElementsByTagName("link")[0];
links.parentNode.appendChild(elm);
</script>
There will also be a noscript entry near the top of the page:
Code:
<noscript><link rel="stylesheet" type="text/css" href="min/?f=/includes/templates/MY_TEMPLATE/css/defer/something.css&1570615485" /></noscript>
Pretty sure this works.
Bookmarks