Skip to content

This WordPress plugin enables to pass the "Eliminate render-blocking JavaScript and CSS in above-the-fold content"-rule from Google PageSpeed Insights.

Notifications You must be signed in to change notification settings

dmatora/above-the-fold-optimization

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 

Repository files navigation

WordPress Above The Fold Optimization

This plugin enables to pass the "Eliminate render-blocking JavaScript and CSS in above-the-fold content"-rule from Google PageSpeed Insights.

https://wordpress.org/plugins/above-the-fold-optimization/

The functionality of this plugin is simple and light-weight. The plugin simply inserts Critical Path CSS code inline, helps to create it and optionally optimizes the delivery of the full website CSS.

The plugin is intended to work together with other optimization plugins such as W3 Total Cache and Autoptimize.

Note: The plugin is intended to achieve the best possible result, not easy usage. It is intended for advanced WordPress users and optimization professionals.

Critical Path CSS generation

The plugin enables automated Critical Path CSS generation via Penthouse.js. The plugin will execute Penthouse.js to generate Critical Path CSS for multiple responsive dimensions and pages. It then combines the resulting CSS-code and then compresses the CSS-code via Clean-CSS.

Full CSS extraction

The plugin enables the extraction of full CSS from pages for use in critical path CSS generation.

Javascript localization

The plugin enables the localization of external javascript resources such as Google Analytics and Facebook SDK to pass the "Leverage browser caching"-rule from Google PageSpeed Insights.

CSS Delivery Optimization

When the option Optimize CSS Delivery is enabled all CSS links are loaded asynchronously via an optimized version of LoadCSS and rendered via requestAnimationFrame API following the recommendations by Google.

Demo

The following demo is an original WordPress blog v4.4.2 with the default theme, Autoptimize javascript and CSS optimization, W3 Total Cache for full-page cache and the Above The Fold Optimization plugin. Using just these 3 plugins it is possible to achieve a PageSpeed 100-score.

https://abovethefold.optimalisatie.nl/

https://developers.google.com/speed/pagespeed/insights/?url=https%3A%2F%2Fabovethefold.optimalisatie.nl%2F&tab=mobile

Installation

WordPress plugin installation

  1. Upload the above-the-fold-optimization/ directory to the /wp-content/plugins/ directory
  2. Activate the plugin through the 'Plugins' menu in WordPress
  3. Navigate to the plugin settings-page
  4. Generate Critical Path CSS

To make use of automated Critical Path CSS generation it is required to install the following software on the server:

  1. PhantomJS: npm install -g phantomjs
  2. Clean-CSS: npm install -g clean-css From the above-the-fold-optimization/ directory:
  3. npm install

To be able to generate Critical Path CSS from within the WordPress admin the software needs to be executable from PHP which may pose a security risk. An alternative option is to generate a CLI command to execute via SSH.

Maintainers

License

(C) www.optimalisatie.nl 2014–2016, released under the MIT license

About

This WordPress plugin enables to pass the "Eliminate render-blocking JavaScript and CSS in above-the-fold content"-rule from Google PageSpeed Insights.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published