Very Reliable for CSS, JS Depends on your Scripts
-
I came across this plugin as I tried to optimize my Google PageSpeed, and wanted to try some of their recommendations.
I primarily use this plugin for CSS. It has great options for where and how to insert the CSS, including inline in the header or footer. Putting the combined and minified CSS inline in the footer requires adding some short inline CSS to the header to prevent a flash of unstyled text. For example:
<style rel='stylesheet'type='text/css'/>html{margin:-9999px;} body{background-color:#1E2F2C;}</style>
I had a few CSS files from a plugin that weren’t getting combined and minified by
Async JS and CSS
. The problem was that the other plugin registered these styles withwp_register_style
but never enqueued them. Addingwp_enqueue_style('handle');
calls for each of these files to my child themefunctions.php
file fixed that.I go back and forth using this and another minify plugin for the javascript files. Ideally I’d like to load JQuery separately to speed up the page if viewers already have it on their computer. I ran into a bunch of problems loading the different scripts asynchronously with
async
, even with JQuery in the header and the others in the footer. The other minify plugin had problems grabbing JQuery from the header, and also grabbing and some of the other JS files that usedwp_localize_script
to add inline JS.Async JS and CSS
gives the capability to load JQuery separately, never misses any of my JS files. Unfortunately I have trouble excluding them though, specifically JQuery. It queues all the JS files into an array and loads them with the Google recommendedloadAsyncScript
function. Depending on the page size and number of scripts I get “JQuery not defined” errors from some of the scripts. It worked for the most part before I installed a Lazy Load on my local host. UnfortunatelyAsync JS and CSS
doesn’t have an option to combine the JS files, which I think would help with some of my issues.All in all it does things for CSS that no other plugin I found can do. It may also do a decent job with your JS files depending on your structure and if you’re using Lazy Load. Thanks!
- The topic ‘Very Reliable for CSS, JS Depends on your Scripts’ is closed to new replies.