Most advanced optimization software such as critical path CSS creation are easiest to use using a build tool such as Grunt.js and Gulp.js. While those build tools make it easy to use professional software for experienced developers, most average WordPress users will not be able to use them and thus have no access to professional optimization software.
This WordPress based build tool builder enables professional critical path CSS creation via critical (by a Google engineer) using the build tool Gulp.js.
Warning: No build tool support is provided via the WordPress support forum! Bugs, software or build tool conflicts occur often and may be OS, Node-software or dependency (version) related. It often is complex, even for the most experienced developer. Please seek help via the (Github) support forums of relevant software. This build tool builder simply relies on 'the latest version' and does not consider bugs or conflicts in the latest software.
How to use
This WordPress tool creates Gulp.js Critical Path CSS Cenerator Task Packages that make it easy to create professional quality critical path CSS for individual pages.
Getting started
Step 1: Follow the installation instructions
Step 2: create a Critical CSS Task Package
Step 3: start a command line prompt or SSH shell, navigate to /wp-content/themes/THEME_NAME/abovethefold/ and run the task, e.g. gulp task-name.
Test the quality of the created critical path CSS using the Critical CSS Quality Test and optionally use the file extra.css to fix problems in the generated Critical Path CSS.
Installation
Requirements:
- A regular PC (Windows, Mac or Linux) with command line.
- The installation of Node.js (click here for a how-to).
- The installation of Gulp.js (
npm install --global gulp-cli).
The installation of the WordPress Gulp.js Critical Path CSS Generator is required just once for your theme. NPM (Node.js Package Manager) will read the dependencies from package.json and will install them in the /abovethefold/ directory.
Step 1: download package.json and gulpfile.js and upload the files to /wp-content/themes/THEME_NAME/abovethefold/. Alternatively click "Auto install" (this will copy the files to your theme directory).
buildtool->is_installed()) {
print ' ';
} else {
print ' ';
}
?>
Step 2: start a command line prompt or SSH shell and navigate to /wp-content/themes/THEME_NAME/abovethefold/.
Step 3: run the command npm install.
If there are errors during installation you will not be able to get support via the WordPress support forums.
Please seek help in platform or software related support forums, for example Github.
More Optimizations
There are many other WordPress optimizations that can be performed via Grunt.js or Gulp.js, for example Google WebP image optimization, uncss (unused CSS stripping), CSS data-uri (CSS images) and more. Search Google for more information.
Tip: optimize images of your /themes/ and /uploads/ directory using Gulp.js or Grunt.js imagemin using professional image compression software, including Google WebP, and instead of overwriting the original images like many other solutions, place the images in a subdirectory /wp-content/optimized/ and have Nginx serve the optimized image only when the optimized version is newer. It will result in the best performance, with the best image optimization and instant refresh of images when updated in WordPress. And when you want to apply a new image optimization technique, you will have the original files available. A server cron makes it possible to optimize updated images daily.