Autoptimize criticalcss.com power-up

Description

This plugin extends Autoptimize to automatically create critical CSS rules. These rules inject the correct critical CSS in different types of pages to ensure these pages are rendered even before the full CSS is loaded, improving the “start to render time” and user experience. For this purpose the plugin integrates with criticalcss.com, a 3rd party service, to have it generate the critical CSS.

Simply install and activate the plugin (you will need to have Autoptimize up and running), enter your https://criticalcss.com API key and the plugin will automatically start work to create rules.

If you want to change settings or review the rules, you can find these by clicking the “critical css” tab on the Autoptimize plugin settings screen. There are “installation instructions” and more info in the FAQ.

Screenshots

Installation

  1. Install from your WordPress “Plugins > Add New” screen (search for Autoptimize)
  2. Activate the plugin.
  3. You will see a “Critical CSS”-tab in Autoptimize.
  4. Enter the API key from your https://criticalcss.com
  5. (optional): create a default rule which can be used if no automated rule applies.
  6. (optional): create manual Path-based rules for specific pages to override automated rules. If you leave the critical CSS field of path-based rules empty, the plugin will automatically extract it.
  7. To get critical CSS going, make sure there are requests coming in that are not served by a page cache

FAQ

Installation Instructions
  1. Install from your WordPress “Plugins > Add New” screen (search for Autoptimize)
  2. Activate the plugin.
  3. You will see a “Critical CSS”-tab in Autoptimize.
  4. Enter the API key from your https://criticalcss.com
  5. (optional): create a default rule which can be used if no automated rule applies.
  6. (optional): create manual Path-based rules for specific pages to override automated rules. If you leave the critical CSS field of path-based rules empty, the plugin will automatically extract it.
  7. To get critical CSS going, make sure there are requests coming in that are not served by a page cache
Where do I get an API key from?

Please sign up at https://criticalcss.com then go to CriticalCSS.com API Keys. This is a premium service, so be sure to read the additional pricing information!

At the time of writing (4 May 2018) the price for using CriticalCSS.com is:

£2/month for membership + £5/domain/month.

This means the total cost will be £7/month if you use this plugin for one site.

If you’re not sure yet; with the 30 day free trial, you have nothing to lose!

Will this work for inside paywalls or membershp sites?

No; CriticalCSS.com needs the pages for which it has to generate critical css to be publicaly visible to work.

What are the Terms of Service for CriticalCSS.com usage

See https://criticalcss.com/general/terms-of-service/.

Why isn’t the critical CSS visible immediately?

Critical CSS generation is based on a job-queue. For jobs to be added to the queue, your site should have requests and those requests should not be served by a page cache (because in that case WordPress and Autoptimize are not triggered). If you want to speed things up, you can temporarily disable your page cache and click around on your website yourself.

Once a job is in the queue it can be executed and sent to criticalcss.com and at one of the next queue runs the critical CSS is retrieved and turned into a rule and it will be used for the next matching request (again for a page not in page cache).

What if my hosts limits the time PHP processes can run?

Autoptimize CriticalCss.com power-up uses scheduled jobs to go over a queue with URL’s for which to fetch critical CSS. If there are many items in the queue, the process can take a couple of minutes to finish. If your hosts limits the time scheduled PHP processes can run, you can set the number of requests sent to criticalcss.com (the “request limit”) under the Advanced Options.

Can I stop critical CSS being applied on some pages?

Yes; create a manual rule (can be both path- and conditional-tag based) and enter none for critical CSS. If the rule matches, no critical CSS will be added and the full CSS will be inlined instead.

Reviews

I love this plugin!

My site has over 100 pages and the thought of using a manual critical css generator was daunting. This plug in does the job well and easily. The support was amazing as well when I had a little conflict with my theme. Thank you! You saved me a lot of work!

Read all 1 review

Contributors & Developers

“Autoptimize criticalcss.com power-up” is open source software. The following people have contributed to this plugin.

Contributors

Changelog

1.5.0

  • bugfix: when deactivating make sure lockfile is removed before removing cache directory.
  • bugfix: make sure Autoptimize’s “inline & defer above the fold CSS” is not removed when submitting criticalcss API key.
  • bugfix: ensure order of rules does not depend on when they were added, but is custom post types first, template 2nd, plugins (Woo, EDD, BuddyPress & BBPress) conditional tags and lastly the WordPress core conditionals.
  • bugfix: make sure non-core conditionals are checked against.

1.4.0

  • move cache to wp-content/uploads/ao_ccss/ (to prevent files from being deleted by a sometimes overzealous WP Super Cache purge)
  • warn if DISABLE_WP_CRON is true
  • update default viewport size in advanced settings

1.3.0

  • New: you can now create manual rules to make sure no Critical CSS is injected by entering none as critical CSS.
  • Improvement: make sure “advanced options” are visible when “activate inline & defer” warning is shown
  • Further copy changes in description (thanks for the great feedback Paul!)

1.2.0

  • New advanced option: “Fetch Original CSS”
  • Minor copy changes in Key settings panel and FAQ.

1.1.0

  • Changes to queue processing to cater for hosts with hard limits on PHP processes duration

1.0.1

  • Extra info on the API key entry page

1.0.0

  • Initial release