WP-Super-Cache logo

Minify WP-Super-Cache HTML cache files: WPSCMin a WP-Super-Cache plugin

The WordPress WP-Super-Cache cache plugin doesn’t minify HTML cache files, which I find a disadvantage. Knowing minify libraries, I went looking for an existing solution (why reinvent the wheel?), and found one: WPSCMin. Read on …

Why the need to minify HTML cache files?

Minifying cache files is important in my opinion, because smaller minified files are downloaded faster. And minifying is what WPSCmin does.

The WPSCMin plugin for WP-Super-Cache relies, according to its documentation, on the mrclay/minify library, for minification of HTML, CSS and JavaScript files. And JavaScript is where it goes wrong, the repository doesn’t provide the required JSMinPlus.php file, causing PHP errors. I found the mattheu/MinQueue WordPress Plugin does ship with a minify library containing JSMinPlus.php. It is in the PHP-Minify-Lib directory, and I chose to try that one instead.

WPSCMin PHP code change

Since WPSCMin relies on mrclay/minify PHP library, you need to make a small code change if you use MinQueue’s PHP-Minify-Lib directory. In the file wp-content/plugins/wp-super-cache/plugins/WPSCMin.php, replace all occurances of

$this->minify_path/min/lib/Code language: PHP (php)


$this->minify_path/PHP-Minify-Lib/Code language: PHP (php)

or simply rename the PHP-Minify-Lib directory.

Looking to minify Javascript and CSS with YUI Compressor and/or UglifyJS 2?

Update on mrclay/minify & WPSCMin

Joel of WPSCMin replied to my email (thanks!), and pointed me on the mrclay/minify releases: https://github.com/mrclay/minify/releases. The most recent release, which was in October 2014, still ships the required JSMinPlus.php file. So, when adding WPSCMin as a plugin to WP-Super-Cache, be sure to check out the minify-releases, and not only the raw GitHub head as I did.

Jan Reilink

Hi, my name is Jan. I am not a hacker, coder, developer or guru. I am merely an application manager / systems administrator, doing my daily thing at Embrace - The Human Cloud. In the past I worked for clidn and Vevida. With over 20 years of experience, my specialties include Windows Server, IIS, Linux (CentOS, Debian), security, PHP, websites & optimization. I blog at https://www.saotn.org.