Fast Velocity Minify

Description

This plugin reduces HTTP requests by merging CSS & Javascript files into groups of files, while attempting to use the least amount of files as possible. It minifies CSS using PHP only and gives you the option to minify JS files with PHP Minify (no extra requirements).

Minification is done in real time and done on the frontend only leading to a slower first request. Once the first request is done the other pages that require the same set of minified CSS and JavaScript will be served with a static cache file.

Fast Velocity Minify will check if any of your theme and plugins CSS or JS files are newer than the cached merged files and reprocess the minification. Example: If you update a plugin or theme that overwrites a CSS or JavaScript that is being merged by this plugin, it will automatically generate a new minified file for you in real time.

Aditional Optimization

I can offer you aditional custom made optimization on top of this plugin. If you would like to hire me, please visit my profile for further information.

Features

  • Merge JS and CSS files into groups to reduce the number of HTTP requests
  • Google Fonts concatenation and optimization
  • Handles scripts loaded both in the header & footer separately
  • Keeps the order of the scripts even if you exclude some files from minification
  • Supports localized scripts (https://codex.wordpress.org/Function_Reference/wp_localize_script)
  • Minifies JS with PHP Minify.
  • Minifies CSS with PHP only, no third party software or libraries needed.
  • Option to defer JavaScript loading of the minified JS files.
  • Stores cache and minified files in the plugin directory.
  • Checks the last modified date on merged CSS and JS files so that the minified files are always up to date.
  • View the status and logs on the WordPress admin page.
  • Option to Minify HTML for further improvements.
  • Ability to turn off minification
  • Ability to turn off merging + minification (by disabling either css or js processing)
  • Ability to manually ignore scripts or css
  • Support for conditional scripts and styles
  • Support for multisite installations
  • Support for gzip_static on Nginx
  • Support for the CDN Enabler plugin
  • and some more…

Notes

  • The JavaScript minification is by PHP Minify
  • Compatible with Nginx, HHVM and PHP 7.
  • Minimum requirements are PHP 5.5 and WP 4.4, from version 1.4.0 onwards

Screenshots

  • You can view the logs and purge individual merged files.
  • The settings page. By default, all settings are already optimized.

Installation

  1. Upload the plugin folder to the /wp-content/plugins/ directory or upload the zip within WordPress
  2. Activate the plugin through the Plugins menu in WordPress
  3. Configure the options under: Settings > Fast Velocity Minify and that’s it.
  4. Check that you have permissions for PHP to call the jar files if the JS minification fails and you have PHP exec and Java available.

FAQ

How can I remove Font Awesome if I’m not using it on my theme or plugins?

If your theme doesn’t make use of font-awesome in any way and you are not enqueuing it at all on your theme or plugins, you can select the “Disable Font Awesome optimization” and this will stop the plugin from adding the fonts to the site. The default is to remove any duplicates it finds and add our own version to the footer asynchronously.

How can I exclude certain assets by wildcard?

You can exclude css or js files by using a single wildcard symbol “*” at the end of the url. For example, //yoursite.com/wp-content/plugins/some-plugin/js/* will ignore all files inside that directory. You can also shorten the url like some-plugin/js/* and then it will match any css or js url that has some-plugin/js/* on the path. Obviously, doing this /js/* would match any files inside any “/js/” directory and in any location, so to avoid unexpected situations please always use the longest, most specific path you can use.

Why are there several js and css files listed on the logs page?

Those files are created whenever a new set of javascript or css files are found on your front end. This is because your plugins and themes might load different scripts and css per page, post, category, tag, homepage or even custom post types. If you always load the exact same css and javascript in every page on your site, you won’t see as many files.

What about logged in users?

When you are logged in as admin for example, you might have the admin bar on top or other custom css and javascript that can be added by WordPress to the frontend. In that case, a new set of minified files would be created for logged in users only. This is needed because the plugin tries to have as less files as possible on each page in the frontend.

Can I update other plugins and themes?

On every page load we compare the last modified date of all the original needed JavaScript and CSS with the generated cache. This is a fast and normal operation in PHP without any performance impact on the loading time. When you upgrade something on your WordPress site that overwrites any CSS or JavaScript file needed for the frontend, our plugin will automatically invalidate the cache for that specific page and regenerate a new one for you.

Do I need to purge the cache directory?

If you are changing to other plugins and themes, then you should purge the files once in a while. All else being equal, when the site invalidates a cache file it deletes the minified files automatically. When you add or remove plugins that add /remove CSS and JavaScript to the frontend, the needed files signature for that pageview will change, thus avoiding our cache invalidation checks. This happens, because it’s considered a new set of files that the plugin needs to merge and minify, rather than an update to the same set of files.

Is it compatible with other caching plugins?

Yes. The only time it would stop working is if you manually purge the minified files on our plugin without purging the cache on your cache plugin. This happens because when you use a caching plugin, your HTML is cached and therefore will keep pointing to the old minified files. If you ever encounter such situation, simply delete the cache on your caching plugin.

Is it resource intensive, or will it use too much CPU on my shared hosting plan?

No it’s not. The generation of the minified files takes only a couple of seconds and it’s done only once per page (and only if needed). After that all requests will be served a static file from the cache directory. There is no PHP involved on serving the minified files after the first request.

Is it compatible with multisites?

It should be compatible as it generates a new cache file for every different set of requirements it finds.

Is it compatible with Adsense and other ad networks?

This plugin should be compatible with any add network, depending on how you’re loading the ads into the site. We only merge and minify css and javascript files enqueued in the header and footer, which would exclude any ads, as they are usually inserted (not enqueued) directly on the template. Therefore, you should have no problems if you are following the normal adsense implementation of copy pasting your code into the theme.

After installing, why did my site became slow?

Please note that the cache regeration happen’s once per page but only if the required CSS + JS files change. If you need the same set of CSS and JS files in every page, then the cache will only be generated once and reused for all other pages. If you have different CSS + JS files being loaded in every page, then the first view for those pages will be slower… however, the second and further requests will be much faster.

Whats the intermediate minification cache for?

Each page on your site requires a possibly different set of JS and CSS files and while merging is fast, minification is slow. To speed up things, whenever we find a JS or CSS file that needs minification, we minify it and keep it on the intermediate cache. The next time a page requires any of those files, it doesn’t need to minify those again thus speeding things up by minifying only the new required files.

How do I use the precompressed files with gzip_static on Nginx?

When we merge and minify the css and js files, we also create a .gz file to be used with gzip_static on Nginx. You need to enable this feature on your Nginx configuration file if you want to make use of it. If you’re upgrading from 1.2.3 or earlier, you may need to clear the plugin cache.

After installing, why is my design or layout broken or some images and sliders are not showing?

Please note that each theme is coded differently and that your theme needs to follow the standard wordpress way of enqueueing css and js files, as well as to make use of conditionals and mediatypes properly for our plugin to work as it should.

Here are some of the more usual cases:
  • CSS Merging: Some theme authors have no idea that they should use the wp_style_add_data to add conditional IE only stylesheets… so instead, they print the whole code snippet on the header and therefore, minification plugins have no way to know that a css or js file is to be loaded for Internet Explorer only.

If you are using one of these themes, take a look at the plugin “status” page and click “View Log” for each generated css or js file.
There’s a chance that their “IE only” css file got merged together, thus breaking the design… in that case, simply copy the url and add it to the ignore list.
If you want to go the extra mile, report the bug to the theme developer and have them read: https://developer.wordpress.org/reference/functions/wp_style_add_data/

  • JS Defer: If you have a theme that heavily relies on javascript and jQuery (usually with sliders, paralax animations, etc) you cannot in most cases defer JavaScript and you should at least exclude jQuery from processing in the plugin settings.

Some theme developers make use of jQuery during the page load and write jQuery code directly on the HTML… if you defer jQuery, it will not run until after the html page loads and thus, whatever jQuery code the theme has cannot run (common with animations and sliders) because jQuery is not yet defined. This “undefined” error (when it happens) is visible if you defer all javascript and then refresh the page unsing Google Chrome Developer Tools and take a look at the Console tab.

There’s no obvious solution for this because the theme was built that way and it needs jQuery to be render-blocking in order to work (and sometimes other js files are needed too). You could have a proper developer copy and edit all that inlined jQuery code to an external js file and load it with jQuery as a dependency to update the content with ajax (asynchronous)… but not always possible.
If that’s your case, then your theme can never have a perfect pagespeed score.

  • JS merging and minification: Be aware that with so many plugin authors and theme developers, not always their js code works well together when merging or minifying. Some coders are better than others and different people follow different practices of coding.

Some plugins cannot be merged together with others (put them on the ignore list) because they have errors or incompatible code, were not Linted properly, etc. Example: Most notabily, the Select2 js file included in several woocommerce is not utf-8 encoded (!), so it breaks the whole thing when merged with other js files.

Some other plugins have minified their scripts but haven’t renamed it to .min.js (so we cannot have a way to know that). Most already minified js files cannot be minificated a second time (such as the default wordpress jquery.js file) and they will break if double minification is done.

In most cases for a quick fix, you can try to disable js processing and see if it fixes your layout issues… and if it does, you need some basic wordpress knowledge (or a developer) to find which file is causing conflict and then add it’s urls to the ignore list.

If you have no idea, I recommend adding them all to the ignore list and then one by one trying to delete each url until you find the one causing trouble.

How to undo all changes done by the plugin?

The plugin itself doesn’t do any “changes” to your site, it intercepts some sections and replaces it with a new optimized version of those files (in other words, your files are untouched). As with any plugin, if you panic simply disable or uninstall the plugin and the site will go back to what it was before installing it. The plugin itself doesn’t delete anything from the database or modify any files.

Why is it that even though I have disabled or removed the plugin, the design is still broken?

While this is very rare, it can happen if you have some sort of cache enabled on your site or server. A cache means that the site or server makes a static copy of your page and serves it for a while (until it’s deleted or expires) instead of loading wordpress directly to the users. Some hosting providers such as Godaddy (and their derivates) enforce their own cache plugin to be installed and creates a new menu which allows you to purge the cache.

If you don’t see any option anywhere to clear your cache, you can contact your hosting provider or developer to clear the cache for you and to provde you instructions so you can do it in the future.

I have a complaint or I need support right now. Why haven’t you replied to my topic on the support forum yet?

Before getting angry because you have no answer within a few hours (even with paid plugins, sometimes it takes days…), you should first be informed about how wordpress.org and the plugins directory work. The plugins directory is an open source, free service where developers and programmers contribute (on their free time) with plugins that can be downloaded and installed by anyone “at their own risk” and are all released under the GPL license.

While all plugins have to be approved and reviewed by the wordpress team before being published ( for dangerous code, spam, etc ) this doesn’t change the license or add any warranty. All plugins are provided as they are, free of charge and should be used at your own risk (so you should make backups before installing any plugin or performing updates) and it’s your sole responsability if you break your site after installing a plugin from te plugins directory.

Support is provided by plugin authors on their free time and without warranty of a reply, so you can experience different levels of support level from plugin to plugin. As the author of this plugin I strive to provide support on a daily basis and I can take a look and help you with some issues related with my plugin, but please note that this is done out of my goodwill and in no way I have any legal or moral obligation for doing this.

For a full version of the license, please read: https://wordpress.org/about/gpl/

Where can I get support?

You can get support on the official wordpress plugin page at: https://wordpress.org/support/plugin/fast-velocity-minify

How can I donate to the plugin author?

If you would like to donate any amount to the plugin author (thank you in advance), you can do it via Paypal at https://goo.gl/vpLrSV

Reviews

el mejor

El mejor plugin para el molesto mensaje de ” web lenta”.
Compatible 100% con la 4.7.3 sin necesidad de hacer cambios de css ni de javascript.
5 estrellas

So far so good!

This minifying plugin is the only one that i’ve encountered that actually delivers. Reduces load times for first time as well as repeated users with no penalty for first time visits.

Great but had to outsource CSS processing to Autoptimize

Works great, reduced requests and load time as advertised. Unfortunately it killed the CSS for my site regardless of subfeature disabling. Ended up I had to disable CSS processing altogether and use Autoptimize’s CSS minification to work. Still, grateful for your work and for making it free. Thank you.

Increase from “C” to “A” 93

I use the Total WordPress Theme with Visual Composer plugin for my real estate photography website. I host with Flywheels, who does a great job for providing nearly 100% managed WordPress hosting. However, I was getting an 83/C score on Pingdom due to the CSS and Javascript needing to be combined and minified. I installed the compatible plugin from Fast Velocity and as the name implies, it took my website load time from a C to an A with a 93 score at 1.27 sec page load. Really nice to see a plugin work so well first time right out of the box! Thank you!
Frank
https://agentschoice360.com

Great performance plugin

Great performance from this plugin. Does it’s work quietly in the background. Has worked great on our WooCommerce site with Dreamhost hosting. Has been stable and reliable and is regularly enhanced. Great plugin.

Read all 30 reviews

Contributors & Developers

“Fast Velocity Minify” is open source software. The following people have contributed to this plugin.

Contributors

Changelog

1.4.3 [2017.03.10]

  • changed minimum requirements to PHP 5.4 for older clients

1.4.2 [2017.02.26]

  • fixed another warning when debug mode is active on wordpress

1.4.1 [2017.02.26]

  • fixed a warning when debug mode is active on wordpress

1.4.0 [2017.02.24]

  • added option to force HTTP or HTTPS protocol to the generated files, so it can work with the CDN Enabler plugin
  • fixed compatibility for sites where home_url() and site_url() differ (some files could not be find by the plugin)
  • fixed removing valid code from .svg images when “removal of query strings for Web Fonts” was on the default settings
  • changed the “defer of JS for Pagespeed Insights” option so it ignores scripts that already have the async or defer attribute
  • changed the “defer of JS for Pagespeed Insights” so it doesn’t defer external resources https://www.chromestatus.com/feature/5718547946799104
  • changed so that Font Awesome now loads asynchronously in the footer, unless “Disable Font Awesome optimization” is selected
  • changed minimum requirements to PHP 5.5 and WP 4.4 for compatibility reasons.
  • removed YUI and Google Closure for simplicity thus making JS minification default to PHP MINIFY
  • updated the faq questions

1.3.9 [2017.01.15]

  • stop removing some important CSS comments during HTML minification

1.3.8 [2017.01.11]

  • added support to strip html comments during HTML minification
  • added wildcard support to the ignore list (url’s must end in ), ex: http://yourdomain.com/wp-content/plugins/some-plugin/dynamic-css-
  • changed mrclay HTML library to an older version (same as WP Rocket 2.91) due to unecessary line breaks on HTML minification
  • changed some code on mrclay HTML library in order to properly minify some inline css styles
  • changed absolute urls during minification to protocol-relative URLs for better https compatibility
  • changed the plugin cache directory to the uploads directory for better compatibility with Google App Engine and Amazon Elastic Beanstalk (beta)

1.3.7 [2016.12.03]

  • stop removing html comments from html minification for better compatibility with some plugins

1.3.6 [2016.11.29]

  • fixed a bug where sometimes the paths and urls have double slashes in the middle leading to those files not being found
  • fixed a bug that was stripping the conditional IE tags for javascript and some css files

1.3.5 [2016.11.25]

  • added option to automatically exclude dynamically generated css and js files

1.3.4 [2016.11.25]

  • added option to defer all JS files for Pagespeed Insights tests only
  • fontawesome improvements

1.3.3 [2016.11.16]

  • fixed a bug where the ignore list was not being completely ignored when defer javascript is enabled
  • added some options to exclude jquery from other sections

1.3.2 [2016.11.16]

  • added option for inlining all CSS
  • added option for inlining google fonts as woff (modern browsers only)
  • added option for optimizing fontawesome
  • bug fixes

1.3.1 [2016.10.31]

  • fixed some other reported notices that are visible when debug mode is enabled

1.3.0 [2016.10.23]

  • fixed a few notices that are visible when debug mode is enabled
  • fixed keeping of CSS handles with empty src for better dependency management (JS processing already does this)

1.2.9 [2016.10.22]

  • added merging of “screen” and “all” CSS mediatypes
  • added auto reordering of CSS files by mediatype
  • added support to keep order of CSS for better compatibility
  • fixed a bug with CSS where “print” mediatypes were being merged together with “all”, breaking some designs
  • added an option to remove Print Style Sheets (CSS files of mediatype “print” for printers)
  • changed the defer JS files logic in order to skip files that are on the ignore list
  • added option to force JS files defer even if they are on the ignore list
  • improved some descriptions for some options in the settings page
  • added option to remove emojis support

1.2.8 [2016.10.21]

  • added font awesome optimization and cdn delivery (if used by your theme)
  • load only one font awesome css file, even when your theme or plugins enqueue multiple files
  • replaced the HTML minification engine with mrclay minify (same as the autoptimize plugin, w3 total cache and a few other popular plugins)

1.2.7 [2016.10.18]

  • fixed CSS minification not working on some cases after the latest update

1.2.6 [2016.10.16]

  • improved html minification speed and compatibility
  • fixed a PHP 7 compatibility issue on PHP Minify JS minify script
  • fixed the JS defer option for scripts that already have defer or async, such as the AMP plugin

1.2.5 [2016.10.03]

  • reverted back the PHP Minify library due to a bug

1.2.4 [2016.10.03]

  • added support for gzip_static on nginx for cached files
  • updated PHP Minify with today’s release date
  • added donation link to the FAQ’s section

1.2.3 [2016.10.02]

  • google fonts related bugfixes
  • improved help section

1.2.2 [2016.09.22]

  • bugfixes

1.2.1 [2016.09.22]

  • more improvements on multisite installations

1.2.0 [2016.09.22]

  • improved compatibility with multisite instalations

1.1.9 [2016.09.21]

  • fixed a fatal error on versions older than PHP 5.5 (note that our recommended PHP version is still PHP 5.6+)

1.1.8 [2016.09.20]

  • fixed support for custom directory names on wordpress (wp-content, plugins, etc)
  • bug fixes

1.1.7 [2016.08.26]

  • fixed a compatibility issue with SunOS and Solaris systems

1.1.6 [2016.08.24]

  • changed the CSS minification to PHP Minify for better compatibility with the calc() expression and others.
  • fixed a bug for when wp-content has been renamed to something else

1.1.5 [2016.08.21]

  • better support for third party cache plugins
  • bug fixes

1.1.4 [2016.08.20]

  • added logic for when wp-content has been renamed to something else
  • small improvements

1.1.3 [2016.08.05]

  • minor bug fix on the defer javascript option

1.1.2 [2016.08.02]

  • added option to force the use of PHP Minify for JS minification instead of YUI or Google Closure

1.1.1 [2016.08.01]

  • added PHP Minify [2016.08.01] as fallback for JS files again
  • PHP Minify issues (white screen on PHP 7) might have been fixed
  • other small bug fixes

1.1.0 [2016.07.11]

  • improved compatibility for PHP 7
  • new location for cache and temporary files
  • removed PHP Minify as fallback due to incompatibility (white screen) with some PHP 7 configurations
  • Fallback method for JS files updated to merge only

1.0.9 [2016.07.10]

  • added new logic to group handling for better compatibility
  • added an intermediate minification cache for faster performance
  • added PHP Minify as fallback option for JS files
  • added a local Google Closure alternative to YUI Compressor
  • added help page to the plugin
  • removed the Google Closure API because their rate limit can lead to incomplete minified files

1.0.8 [2016.07.02]

  • disabled error reporting messages
  • added some extra code checks

1.0.7 [2016.07.01]

  • bug fixes related to warnings being displayed at the admin area

1.0.6 [2016.06.30]

  • fixed some header and footer scripts not being enqueued on the right place
  • added a better dependency check before merging and minifying of JS files
  • added more logic to keep the order of js files, when one or several of them are excluded from minification
  • performance improvements and some code simplification

1.0.5 [2016.06.24]

  • bug fixes on the admin page log viewer

1.0.4 [2016.06.23]

  • added YUI Compressor for local JS minification with java (if available)
  • JS minification fallback to the Google Closure API if java not available or YUI Compressor fails
  • added individual cache for already minified files, so they are minified again only if that cache is older than the original files to minify

1.0.3 [2016.06.23]

  • removed JSrink and added back the Google Closure API for compatibility with PHP 7

1.0.2 [2016.06.23]

  • Fixed Google Fonts optimization
  • Replaced Google Closure API with JSrink PHP library
  • Reorganized inline CSS code dependencies
  • New (safer) HTML minification

1.0.1 [2016.06.22]

  • Javascript minification fixes

1.0 [2016.06.19]

  • Initial Release