futtta / ao_critcss_aas

Autoptimize power-up to integrate with criticalcss.com
9 stars 1 forks source link

=== Autoptimize criticalcss.com power-up === Contributors: futtta, denydias Tags: autoptimize, critical css, above-the-fold, render-blocking css Requires at least: 4.9 Tested up to: 5.2 Stable tag: 1.19.0

Autoptimize criticalcss.com power-up adds automated critical css creation to Autoptimize integrating with the https://criticalcss.com service.

== 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 (see FAQ for info on pricing).

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.

== 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 generate it.
  7. To get critical CSS going, make sure there are requests coming in that are not served by a page cache

== Frequently Asked Questions ==

= Where do I get an API key from/ how is this priced? =

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 membership 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 did nothing happen after I installed the plugin/ 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).

= My hoster claims the plugin is time consuming, is this normal? =

When just installed the plugin will be more active, generating new jobs and for most of those jobs making calls to criticalcss.com. As rules are automatically generated that way, the number of jobs and the number of requests to criticalcss.com will go down significantly.

Most importantly; as the bulk of the work is done asynchronously (by the cronned queue processing job), there is no negative impact on the performance of your site, so your visitors will not notice any slowdown.

= 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 change the number of requests sent to criticalcss.com (the "request limit") under the Advanced Options (default is 5).

= I use a pagebuilder, so my pages are very different yet the same CCSS is applied? =

As from AO CCSS 1.7 there is an (advanced) option you can activate to enforce PATH-based rules creation for pages so each page will end up with its own critical CSS.

= 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.

= I only see "N" jobs and no rules and I'm getting "WordPress cron"-warnings, what should I do? =

If all jobs remain in "N" then wordpress "cron job" that does the queue processing is not getting triggered. To verify you can install the "wp crontrol"-plugin and then under Tools -> Cron Events look for "ao_ccss_queue" and check the "next run" time/ date.

If the "ao_ccss_queue" job is not there, you'll have to de- and re-activate the "autoptimize critical css" plugin to have it re-register the queue-processing task.

If the "ao_ccss_queue" job is there, but has a "next run" date in the past, there is an issue with your site/ hosters WordPress cron and you will have to contact your hoster. Some hosters' info on the topic: WP Engine, BlueHost, HostGator and SiteGround.

= So how can I improve my start render/ first paint times? =

Ensuring the CSS is not render-blocking through this plugin is a first important step to improve rendering performance, but to get a significant better first paint time, you'll need to ensure you have no other render-blocking resources.

Some tips:

= When I clone my site to a new environment or on a domain mapped multi-site environment the queue does not get processed any more? =

As of AO CCSS 1.13.0 the plugin binds itself to a domain to avoid unexpected requests from cloned sites. You can either deactivate and reactivate the plugin to reset the "bound domain" or you can pass false to the autoptimize_filter_ccss_bind_domain filter to disable the domain binding.

== Changelog ==

= 1.19.0 =

= 1.18.0 =

= 1.17.1 =

= 1.17.0 =

= 1.16.0 =

= 1.15.2 =

= 1.15.1 =

= 1.15.0 =

= 1.14.0 =

= 1.13.0 =

= 1.12.0 =

= 1.11.0 =

= 1.10.1 =

= 1.10.0 =

= 1.9.0 =

= 1.8.0 =

= 1.7.0 =

= 1.6.0 =

= 1.5.0 =

= 1.4.0 =

= 1.3.0 =

= 1.2.0 =

= 1.1.0 =

= 1.0.1 =

= 1.0.0 =