sandywp / plugins / async-js-and-css

Async JS and CSS

4.2 out of 5 stars. 4.2 51 reviews

Converts render-blocking CSS and JS files into NON-render-blocking, improving performance of web page.

Launch a sandbox with this plugin → No signup.
Ready in seconds.

v1.7.13 700+ installs WP 2.6+

your-sandbox.sandywp.com/wp-admin
Async JS and CSS running inside a SandyWP sandbox

What you get inside

2 screens
  • Settings page

  • PageSpeed Insights results

About this plugin

When your page is loaded by browser – all that stuff placed in HEAD tag is loaded before the page content – in blocking way. So the content is delivered to user in the last moment, after all javascript and css files are loaded.

If you are a webmaster or just want to make your web to make better your positions on search engines (yes, they preffer faster webs), just take a look on Google PageSpeed Insights – you’ll see that one of the mos important things is fastenes and one of the reason why your page is not so fast – is “Render-blocking JavaScript and CSS”.

This plugin makes ALL scripts loaded by other plugins to be loaded in asynchronous way just like Google PageSpeed Insights recommends.
All CSS files will be inserted inline into the document code or moved from the document beginning to the end, just before closing BODY tag (or just where you placed wp_foot() function). There are various methods to do that – they are all in plugin’s configuration page.

Plugin makes all scripts to be loaded asynchronously using wp_enqueue_script and also can detect scrips included inside of wp_head and wp_footer hooks.

All CSS files loaded using wp_enqueue_style can be loaded just before closing BODY tag by four methods:

* inserting <link rel="stylesheet" ...> tag

* inserting <style>@import url(...);</style>

* generating <link rel="stylesheet" ...> tag with javascript after all have loaded

* inserting ALL CSS CODE INLINE into the document (the fastest way)

I was inspired to create this small plugin by Asynchronous Javascript but it works in completely different way.

Known incompatibilities

* Internet Explorer 7 - Some scripts could be loaded impropertly (trying to fix it)

* Plugin - WP JetPack - Share - everithing works but "More" dropdown menú

* Plugin - Google Analyticator<h3>Special thanks</h3>
* NicMic<h3>TODO</h3>
* Inline JS
* Minify JS
* Cache

Questions

Installation Instructions

Like any other plugin

1. Upload `asyncJSandCSS` folder to the `/wp-content/plugins/` directory

2. Activate the plugin through the 'Plugins' menu in WordPress

3. Configure the plugin if needed (Settings/Async Settings)

Plugin can affect only those files loaded using worpdress’s queue (using wp_enqueue_script and wp_enqueue_style), so if you include your CSS file inserting into head.php of your theme – it WILL NOT be affected and will be loaded in standart render-blocking way.

What can I do with a “Leverage browser caching” warning in Google’s PageSpeed Insights ?

You just need to include cache configuration in your .htaccess file. For example:

<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType image/gif "access plus 6 month"
    ExpiresByType image/jpeg "access plus 6 month"
    ExpiresByType image/png "access plus 6 month"
    ExpiresByType application/javascript "modification plus 1 month"
    ExpiresByType text/css "modification plus 1 month"
</IfModule>

Errors with jQuery

Add this line to exceptions box:

jquery

or if you are using jQuery from Google Hosted Libraries, you need to put:

jquery.min.js

Colorbox is not working

Add this line to exceptions box:

colorbox
colorbox-wrapper

4.2

51 reviews

  • 5 ★ 36
  • 4 ★ 3
  • 3 ★ 3
  • 2 ★ 2
  • 1 ★ 7

Ratings come from WordPress.org. SandyWP does not collect its own reviews.

sandywp / also on the shelf

Try another plugin

  • Async JavaScript

    4.7 · 70K+ installs

    Async Javascript lets you add 'async' or 'defer' attribute to scripts to exclude to help increase the performance of your…

  • Asynchronous Javascript

    3.7 · 100+ installs

    Improve page load performance by asynchronously loading javascript using head.js

  • Lazy Widget Loader

    5.0 · 100+ installs

    Lazy Widget Loader provides lazy loading for widgets to improve page loading. Use on slow widgets with content from Facebook,…

Spin up a real WordPress site in seconds.

Test plugins, build a demo, hand a client a link — then squash it and start again. No local setup, no Docker.