Version Description
[2018.01.06] = * fixed a bug with html minification on some files that should not be minified * fixed a bug with the defer for pagespeed insights * updated the default blacklist (delete all entries and save again, to restore)
Download this release
Release Info
Developer | Alignak |
Plugin | Fast Velocity Minify |
Version | 2.2.6 |
Comparing to | |
See all releases |
Code changes from version 2.2.5 to 2.2.6
- fvm.php +27 -13
- inc/functions-serverinfo.php +2 -0
- inc/functions.php +18 -1
- readme.txt +53 -66
fvm.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://fastvelocity.com
|
|
5 |
Description: Improve your speed score on GTmetrix, Pingdom Tools and Google PageSpeed Insights by merging and minifying CSS and JavaScript files into groups, compressing HTML and other speed optimizations.
|
6 |
Author: Raul Peixoto
|
7 |
Author URI: http://fastvelocity.com
|
8 |
-
Version: 2.2.
|
9 |
License: GPL2
|
10 |
|
11 |
------------------------------------------------------------------------
|
@@ -127,7 +127,7 @@ $fvm_cdn_url = get_option('fastvelocity_min_fvm_cdn_url');
|
|
127 |
$used_css_files = array();
|
128 |
|
129 |
# default blacklist
|
130 |
-
$exc = array('/html5shiv.js', '/excanvas.js', '/avada-ie9.js', '/respond.js', '/respond.min.js', '/selectivizr.js', '/Avada/assets/css/ie.css', '/html5.js', '/IE9.js', '/fusion-ie9.js', '/vc_lte_ie9.min.css', '/old-ie.css', '/ie.css', '/vc-ie8.min.css', '/mailchimp-for-wp/assets/js/third-party/placeholders.min.js');
|
131 |
if(!is_array($blacklist) || strlen(implode($blacklist)) == 0) { update_option('fastvelocity_min_blacklist', implode("\n", $exc)); }
|
132 |
|
133 |
# default ignore list
|
@@ -207,6 +207,7 @@ function fastvelocity_min_files_callback() {
|
|
207 |
$return = array('js' => array(), 'css' => array(), 'stamp' => $_POST['stamp'], 'cachesize'=> $size);
|
208 |
|
209 |
# inspect directory with opendir, since glob might not be available in some systems
|
|
|
210 |
if ($handle = opendir($cachedir.'/')) {
|
211 |
while (false !== ($file = readdir($handle))) {
|
212 |
$file = $cachedir.'/'.$file;
|
@@ -899,6 +900,7 @@ for($i=0,$l=count($header);$i<$l;$i++) {
|
|
899 |
$file_url = fvm_get_protocol($cachedirurl.'/'.$hash.'-'.$ctime.'.min.js');
|
900 |
|
901 |
# generate a new cache file
|
|
|
902 |
if (!file_exists($file)) {
|
903 |
|
904 |
# code and log initialization
|
@@ -1031,6 +1033,7 @@ for($i=0,$l=count($footer);$i<$l;$i++) {
|
|
1031 |
$file_url = fvm_get_protocol($cachedirurl.'/'.$hash.'-'.$ctime.'.min.js');
|
1032 |
|
1033 |
# generate a new cache file
|
|
|
1034 |
if (!file_exists($file)) {
|
1035 |
|
1036 |
# code and log initialization
|
@@ -1109,9 +1112,10 @@ $wp_scripts->done = $done;
|
|
1109 |
# enable defer for JavaScript (WP 4.1 and above) and remove query strings for ignored files
|
1110 |
###########################################
|
1111 |
function fastvelocity_min_defer_js($tag, $handle, $src) {
|
1112 |
-
global $ignore, $enable_defer_js, $defer_for_pagespeed, $wp_domain, $exclude_defer_login;
|
1113 |
|
1114 |
# no query strings
|
|
|
1115 |
if (stripos($src, '?ver') !== false) {
|
1116 |
$srcf = stristr($src, '?ver', true);
|
1117 |
$tag = str_ireplace($src, $srcf, $tag);
|
@@ -1124,9 +1128,13 @@ if($exclude_defer_login == true && stripos($_SERVER["SCRIPT_NAME"], strrchr(wp_l
|
|
1124 |
# reprocess the ignore list to remove the /fvm/cache/ from the list (else won't defer)
|
1125 |
$nignore = array(); if(is_array($ignore)) { foreach ($ignore as $i) { if($i != '/fvm/cache/') { $nignore[] = $i; } } }
|
1126 |
|
1127 |
-
#
|
1128 |
-
$
|
1129 |
-
if (count($
|
|
|
|
|
|
|
|
|
1130 |
|
1131 |
# get available nodes and add create with defer tag (if not async)
|
1132 |
$dom = new DOMDocument();
|
@@ -1140,29 +1148,33 @@ if ($nodes->length != 0) {
|
|
1140 |
$tagdefer = $dom->saveHTML($node);
|
1141 |
}
|
1142 |
|
1143 |
-
#
|
1144 |
-
if
|
1145 |
|
1146 |
-
# no defer
|
1147 |
if ($defer_for_pagespeed != true) { return $tag; } else {
|
1148 |
|
1149 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
1150 |
if(!empty($tagdefer)) {
|
1151 |
$deferinsights = '<script type="text/javascript">if(navigator.userAgent.match(/speed|gtmetrix|x11.*firefox\/53|x11.*chrome\/39/i)){document.write('.json_encode($tagdefer).');}else{document.write('.json_encode($tag).');}</script>';
|
1152 |
return preg_replace('#<script(.*?)>(.*?)</script>#is', $deferinsights, $tag);
|
1153 |
}
|
1154 |
|
|
|
1155 |
return $tag;
|
1156 |
}
|
1157 |
|
1158 |
-
# normal defer enabled
|
1159 |
-
} else { return $tagdefer; }
|
1160 |
}
|
1161 |
###########################################
|
1162 |
|
1163 |
|
1164 |
|
1165 |
-
|
1166 |
###########################################
|
1167 |
# process header css ######################
|
1168 |
###########################################
|
@@ -1354,6 +1366,7 @@ for($i=0,$l=count($header);$i<$l;$i++) {
|
|
1354 |
$file_url = fvm_get_protocol($cachedirurl.'/'.$hash.'-'.$ctime.'.min.css');
|
1355 |
|
1356 |
# generate a new cache file
|
|
|
1357 |
if (!file_exists($file)) {
|
1358 |
|
1359 |
# code and log initialization
|
@@ -1614,6 +1627,7 @@ for($i=0,$l=count($footer);$i<$l;$i++) {
|
|
1614 |
$file_url = fvm_get_protocol($cachedirurl.'/'.$hash.'-'.$ctime.'.min.css');
|
1615 |
|
1616 |
# generate a new cache file
|
|
|
1617 |
if (!file_exists($file)) {
|
1618 |
|
1619 |
# code and log initialization
|
5 |
Description: Improve your speed score on GTmetrix, Pingdom Tools and Google PageSpeed Insights by merging and minifying CSS and JavaScript files into groups, compressing HTML and other speed optimizations.
|
6 |
Author: Raul Peixoto
|
7 |
Author URI: http://fastvelocity.com
|
8 |
+
Version: 2.2.6
|
9 |
License: GPL2
|
10 |
|
11 |
------------------------------------------------------------------------
|
127 |
$used_css_files = array();
|
128 |
|
129 |
# default blacklist
|
130 |
+
$exc = array('/html5shiv.js', '/excanvas.js', '/avada-ie9.js', '/respond.js', '/respond.min.js', '/selectivizr.js', '/Avada/assets/css/ie.css', '/html5.js', '/IE9.js', '/fusion-ie9.js', '/vc_lte_ie9.min.css', '/old-ie.css', '/ie.css', '/vc-ie8.min.css', '/mailchimp-for-wp/assets/js/third-party/placeholders.min.js', '/assets/js/plugins/wp-enqueue/min/webfontloader.js', '/a.optnmstr.com/app/js/api.min.js');
|
131 |
if(!is_array($blacklist) || strlen(implode($blacklist)) == 0) { update_option('fastvelocity_min_blacklist', implode("\n", $exc)); }
|
132 |
|
133 |
# default ignore list
|
207 |
$return = array('js' => array(), 'css' => array(), 'stamp' => $_POST['stamp'], 'cachesize'=> $size);
|
208 |
|
209 |
# inspect directory with opendir, since glob might not be available in some systems
|
210 |
+
clearstatcache();
|
211 |
if ($handle = opendir($cachedir.'/')) {
|
212 |
while (false !== ($file = readdir($handle))) {
|
213 |
$file = $cachedir.'/'.$file;
|
900 |
$file_url = fvm_get_protocol($cachedirurl.'/'.$hash.'-'.$ctime.'.min.js');
|
901 |
|
902 |
# generate a new cache file
|
903 |
+
clearstatcache();
|
904 |
if (!file_exists($file)) {
|
905 |
|
906 |
# code and log initialization
|
1033 |
$file_url = fvm_get_protocol($cachedirurl.'/'.$hash.'-'.$ctime.'.min.js');
|
1034 |
|
1035 |
# generate a new cache file
|
1036 |
+
clearstatcache();
|
1037 |
if (!file_exists($file)) {
|
1038 |
|
1039 |
# code and log initialization
|
1112 |
# enable defer for JavaScript (WP 4.1 and above) and remove query strings for ignored files
|
1113 |
###########################################
|
1114 |
function fastvelocity_min_defer_js($tag, $handle, $src) {
|
1115 |
+
global $ignore, $blacklist, $ignorelist, $enable_defer_js, $defer_for_pagespeed, $wp_domain, $exclude_defer_login, $fvm_fix_editor;
|
1116 |
|
1117 |
# no query strings
|
1118 |
+
$tag = trim($tag); # must cleanup
|
1119 |
if (stripos($src, '?ver') !== false) {
|
1120 |
$srcf = stristr($src, '?ver', true);
|
1121 |
$tag = str_ireplace($src, $srcf, $tag);
|
1128 |
# reprocess the ignore list to remove the /fvm/cache/ from the list (else won't defer)
|
1129 |
$nignore = array(); if(is_array($ignore)) { foreach ($ignore as $i) { if($i != '/fvm/cache/') { $nignore[] = $i; } } }
|
1130 |
|
1131 |
+
# return if in any ignore list
|
1132 |
+
if (count($nignore) > 0 && fastvelocity_min_in_arrayi($src, $nignore)) { return $tag; }
|
1133 |
+
if (count($blacklist) > 0 && fastvelocity_min_in_arrayi($src, $blacklist)) { return $tag; }
|
1134 |
+
if (count($ignorelist) > 0 && fastvelocity_min_in_arrayi($src, $ignorelist)) { return $tag; }
|
1135 |
+
|
1136 |
+
# fix page editors
|
1137 |
+
if($fvm_fix_editor == true && is_user_logged_in()) { return $tag; }
|
1138 |
|
1139 |
# get available nodes and add create with defer tag (if not async)
|
1140 |
$dom = new DOMDocument();
|
1148 |
$tagdefer = $dom->saveHTML($node);
|
1149 |
}
|
1150 |
|
1151 |
+
# when to defer, order matters
|
1152 |
+
if($enable_defer_js == true) { return $tagdefer; }
|
1153 |
|
1154 |
+
# return if no defer, and there's no defer for pagespeed... else pagespeed processing
|
1155 |
if ($defer_for_pagespeed != true) { return $tag; } else {
|
1156 |
|
1157 |
+
# return if external script url https://www.chromestatus.com/feature/5718547946799104
|
1158 |
+
if (fvm_is_local_domain($src) == true) { return $tag; }
|
1159 |
+
|
1160 |
+
# return if there are linebreaks (will break document.write)
|
1161 |
+
if (stripos($tag, "\n") !== false) { return $tag; }
|
1162 |
+
|
1163 |
+
# print code if there are no linebreaks, or return
|
1164 |
if(!empty($tagdefer)) {
|
1165 |
$deferinsights = '<script type="text/javascript">if(navigator.userAgent.match(/speed|gtmetrix|x11.*firefox\/53|x11.*chrome\/39/i)){document.write('.json_encode($tagdefer).');}else{document.write('.json_encode($tag).');}</script>';
|
1166 |
return preg_replace('#<script(.*?)>(.*?)</script>#is', $deferinsights, $tag);
|
1167 |
}
|
1168 |
|
1169 |
+
# fallback
|
1170 |
return $tag;
|
1171 |
}
|
1172 |
|
|
|
|
|
1173 |
}
|
1174 |
###########################################
|
1175 |
|
1176 |
|
1177 |
|
|
|
1178 |
###########################################
|
1179 |
# process header css ######################
|
1180 |
###########################################
|
1366 |
$file_url = fvm_get_protocol($cachedirurl.'/'.$hash.'-'.$ctime.'.min.css');
|
1367 |
|
1368 |
# generate a new cache file
|
1369 |
+
clearstatcache();
|
1370 |
if (!file_exists($file)) {
|
1371 |
|
1372 |
# code and log initialization
|
1627 |
$file_url = fvm_get_protocol($cachedirurl.'/'.$hash.'-'.$ctime.'.min.css');
|
1628 |
|
1629 |
# generate a new cache file
|
1630 |
+
clearstatcache();
|
1631 |
if (!file_exists($file)) {
|
1632 |
|
1633 |
# code and log initialization
|
inc/functions-serverinfo.php
CHANGED
@@ -306,6 +306,7 @@ if(!function_exists('fvm_get_serverload')) {
|
|
306 |
$server_load = '';
|
307 |
$numCpus = 'N/A';
|
308 |
if(PHP_OS != 'WINNT' && PHP_OS != 'WIN32') {
|
|
|
309 |
if(@file_exists('/proc/loadavg') ) {
|
310 |
if ($fh = @fopen( '/proc/loadavg', 'r' )) {
|
311 |
$data = @fread( $fh, 6 );
|
@@ -340,6 +341,7 @@ if(!function_exists('fvm_get_servercpu')) {
|
|
340 |
function fvm_get_servercpu() {
|
341 |
$numCpus = '';
|
342 |
if(PHP_OS != 'WINNT' && PHP_OS != 'WIN32') {
|
|
|
343 |
if (is_file('/proc/cpuinfo')) {
|
344 |
$cpuinfo = file_get_contents('/proc/cpuinfo');
|
345 |
preg_match_all('/^processor/m', $cpuinfo, $matches);
|
306 |
$server_load = '';
|
307 |
$numCpus = 'N/A';
|
308 |
if(PHP_OS != 'WINNT' && PHP_OS != 'WIN32') {
|
309 |
+
clearstatcache();
|
310 |
if(@file_exists('/proc/loadavg') ) {
|
311 |
if ($fh = @fopen( '/proc/loadavg', 'r' )) {
|
312 |
$data = @fread( $fh, 6 );
|
341 |
function fvm_get_servercpu() {
|
342 |
$numCpus = '';
|
343 |
if(PHP_OS != 'WINNT' && PHP_OS != 'WIN32') {
|
344 |
+
clearstatcache();
|
345 |
if (is_file('/proc/cpuinfo')) {
|
346 |
$cpuinfo = file_get_contents('/proc/cpuinfo');
|
347 |
preg_match_all('/^processor/m', $cpuinfo, $matches);
|
inc/functions.php
CHANGED
@@ -47,6 +47,17 @@ return array('cachebase'=>$cachebase,'tmpdir'=>$tmpdir, 'cachedir'=>$cachedir, '
|
|
47 |
}
|
48 |
|
49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
# functions, get hurl info
|
51 |
function fastvelocity_min_get_hurl($src, $wp_domain, $wp_home) {
|
52 |
|
@@ -230,7 +241,8 @@ return fastvelocity_min_Minify_HTML::minify($html);
|
|
230 |
|
231 |
# functions to minify HTML
|
232 |
function fastvelocity_min_html_compression_finish($html) { return fastvelocity_min_minify_html($html); }
|
233 |
-
function fastvelocity_min_html_compression_start() {
|
|
|
234 |
$use_alt_html_minification = get_option('fastvelocity_min_use_alt_html_minification', '0');
|
235 |
if($use_alt_html_minification == '1') { ob_start('fastvelocity_min_minify_alt_html'); }
|
236 |
else { ob_start('fastvelocity_min_html_compression_finish'); }
|
@@ -269,6 +281,7 @@ function fastvelocity_format_filesize($bytes, $decimals = 2) {
|
|
269 |
|
270 |
# get cache size and count
|
271 |
function fastvelocity_get_cachestats() {
|
|
|
272 |
$dir = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(fvm_cachepath()['cachebase'], FilesystemIterator::SKIP_DOTS));
|
273 |
$size = 0; foreach ( $dir as $file ) { $size += $file->getSize(); }
|
274 |
return fastvelocity_format_filesize($size);
|
@@ -343,6 +356,7 @@ if(fvm_server_is_windows() === false) {
|
|
343 |
if (stripos($hurl, $wp_domain) !== false) {
|
344 |
# default
|
345 |
$f = str_ireplace(rtrim($wp_home, '/'), rtrim($wp_home_path, '/'), $hurl);
|
|
|
346 |
if (file_exists($f)) {
|
347 |
if($type == 'js') { $code = fastvelocity_min_get_js($hurl, file_get_contents($f), $disable_minification); }
|
348 |
else { $code = fastvelocity_min_get_css($hurl, file_get_contents($f).$inline, $disable_minification); }
|
@@ -355,6 +369,7 @@ if (stripos($hurl, $wp_domain) !== false) {
|
|
355 |
# failover when home_url != site_url
|
356 |
$nhurl = str_ireplace(site_url(), home_url(), $hurl);
|
357 |
$f = str_ireplace(rtrim($wp_home, '/'), rtrim($wp_home_path, '/'), $nhurl);
|
|
|
358 |
if (file_exists($f)) {
|
359 |
if($type == 'js') { $code = fastvelocity_min_get_js($hurl, file_get_contents($f), $disable_minification); }
|
360 |
else { $code = fastvelocity_min_get_css($hurl, file_get_contents($f).$inline, $disable_minification); }
|
@@ -399,6 +414,7 @@ if(stripos($hurl, $wp_domain) !== false && home_url() != site_url()) {
|
|
399 |
if (stripos($hurl, $wp_domain) !== false) {
|
400 |
# default
|
401 |
$f = str_ireplace(rtrim($wp_home, '/'), rtrim($wp_home_path, '/'), $hurl);
|
|
|
402 |
if (file_exists($f)) {
|
403 |
if($type == 'js') { $code = fastvelocity_min_get_js($hurl, file_get_contents($f), $disable_minification); }
|
404 |
else { $code = fastvelocity_min_get_css($hurl, file_get_contents($f).$inline, $disable_minification); }
|
@@ -411,6 +427,7 @@ if (stripos($hurl, $wp_domain) !== false) {
|
|
411 |
# failover when home_url != site_url
|
412 |
$nhurl = str_ireplace(site_url(), home_url(), $hurl);
|
413 |
$f = str_ireplace(rtrim($wp_home, '/'), rtrim($wp_home_path, '/'), $nhurl);
|
|
|
414 |
if (file_exists($f)) {
|
415 |
if($type == 'js') { $code = fastvelocity_min_get_js($hurl, file_get_contents($f), $disable_minification); }
|
416 |
else { $code = fastvelocity_min_get_css($hurl, file_get_contents($f).$inline, $disable_minification); }
|
47 |
}
|
48 |
|
49 |
|
50 |
+
# detect external or internal scripts
|
51 |
+
function fvm_is_local_domain($src) {
|
52 |
+
$locations = array(home_url(), site_url(), network_home_url(), network_site_url());
|
53 |
+
foreach ($locations as $l) {
|
54 |
+
$l = trim(trim(str_ireplace(array('http://', 'https://', 'www.', 'cdn.', 'static.', 'assets.'), '', trim($l)), '/'));
|
55 |
+
if (stripos($src, $l) === false) { return true; }
|
56 |
+
}
|
57 |
+
return false;
|
58 |
+
}
|
59 |
+
|
60 |
+
|
61 |
# functions, get hurl info
|
62 |
function fastvelocity_min_get_hurl($src, $wp_domain, $wp_home) {
|
63 |
|
241 |
|
242 |
# functions to minify HTML
|
243 |
function fastvelocity_min_html_compression_finish($html) { return fastvelocity_min_minify_html($html); }
|
244 |
+
function fastvelocity_min_html_compression_start() {
|
245 |
+
if (fastvelocity_exclude_contents() == true) { return; }
|
246 |
$use_alt_html_minification = get_option('fastvelocity_min_use_alt_html_minification', '0');
|
247 |
if($use_alt_html_minification == '1') { ob_start('fastvelocity_min_minify_alt_html'); }
|
248 |
else { ob_start('fastvelocity_min_html_compression_finish'); }
|
281 |
|
282 |
# get cache size and count
|
283 |
function fastvelocity_get_cachestats() {
|
284 |
+
clearstatcache();
|
285 |
$dir = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(fvm_cachepath()['cachebase'], FilesystemIterator::SKIP_DOTS));
|
286 |
$size = 0; foreach ( $dir as $file ) { $size += $file->getSize(); }
|
287 |
return fastvelocity_format_filesize($size);
|
356 |
if (stripos($hurl, $wp_domain) !== false) {
|
357 |
# default
|
358 |
$f = str_ireplace(rtrim($wp_home, '/'), rtrim($wp_home_path, '/'), $hurl);
|
359 |
+
clearstatcache();
|
360 |
if (file_exists($f)) {
|
361 |
if($type == 'js') { $code = fastvelocity_min_get_js($hurl, file_get_contents($f), $disable_minification); }
|
362 |
else { $code = fastvelocity_min_get_css($hurl, file_get_contents($f).$inline, $disable_minification); }
|
369 |
# failover when home_url != site_url
|
370 |
$nhurl = str_ireplace(site_url(), home_url(), $hurl);
|
371 |
$f = str_ireplace(rtrim($wp_home, '/'), rtrim($wp_home_path, '/'), $nhurl);
|
372 |
+
clearstatcache();
|
373 |
if (file_exists($f)) {
|
374 |
if($type == 'js') { $code = fastvelocity_min_get_js($hurl, file_get_contents($f), $disable_minification); }
|
375 |
else { $code = fastvelocity_min_get_css($hurl, file_get_contents($f).$inline, $disable_minification); }
|
414 |
if (stripos($hurl, $wp_domain) !== false) {
|
415 |
# default
|
416 |
$f = str_ireplace(rtrim($wp_home, '/'), rtrim($wp_home_path, '/'), $hurl);
|
417 |
+
clearstatcache();
|
418 |
if (file_exists($f)) {
|
419 |
if($type == 'js') { $code = fastvelocity_min_get_js($hurl, file_get_contents($f), $disable_minification); }
|
420 |
else { $code = fastvelocity_min_get_css($hurl, file_get_contents($f).$inline, $disable_minification); }
|
427 |
# failover when home_url != site_url
|
428 |
$nhurl = str_ireplace(site_url(), home_url(), $hurl);
|
429 |
$f = str_ireplace(rtrim($wp_home, '/'), rtrim($wp_home_path, '/'), $nhurl);
|
430 |
+
clearstatcache();
|
431 |
if (file_exists($f)) {
|
432 |
if($type == 'js') { $code = fastvelocity_min_get_js($hurl, file_get_contents($f), $disable_minification); }
|
433 |
else { $code = fastvelocity_min_get_css($hurl, file_get_contents($f).$inline, $disable_minification); }
|
readme.txt
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
=== Fast Velocity Minify ===
|
2 |
Contributors: Alignak
|
3 |
-
Tags:
|
4 |
Requires at least: 4.5
|
5 |
-
Stable tag: 2.2.
|
6 |
Tested up to: 4.9.1
|
7 |
License: GPLv3 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
@@ -72,31 +72,33 @@ I can offer you aditional `custom made` optimization on top of this plugin. If y
|
|
72 |
|
73 |
= How can I exclude certain assets by wildcard? =
|
74 |
|
75 |
-
|
76 |
|
77 |
...
|
78 |
|
79 |
= Why is the ignore list not working? =
|
80 |
|
81 |
-
The ignore list
|
82 |
|
83 |
...
|
84 |
|
85 |
|
86 |
-
= Why are there several or lot's of JS and CSS files listed on the status page? =
|
87 |
|
88 |
-
|
|
|
89 |
|
90 |
...
|
91 |
|
92 |
-
= Can I update
|
93 |
|
94 |
-
Yes, but it's recommended that you purge the
|
95 |
|
96 |
...
|
97 |
|
98 |
= Is it compatible with other caching plugins? =
|
99 |
|
|
|
100 |
The plugin will try to automatically purge several popular cache plugins, however we still recommend you to purge all caches (on whatever you use) if you also manually purge the cache on the plugin settings for some reason.
|
101 |
The automatic purge is active for the following plugins and hosting: W3 Total Cache, WP Supercache, WP Rocket, Wp Fastest Cache, Cachify, Comet Cache, Zen Cache, LiteSpeed Cache, SG Optimizer, Godaddy Managed WordPress Hosting and WP Engine
|
102 |
|
@@ -104,7 +106,7 @@ The automatic purge is active for the following plugins and hosting: W3 Total Ca
|
|
104 |
|
105 |
= Is it resource intensive, or will it use too much CPU on my shared hosting plan? =
|
106 |
|
107 |
-
No it's not.
|
108 |
|
109 |
...
|
110 |
|
@@ -120,121 +122,101 @@ The plugin is compatible with any add network but also depends on how you're loa
|
|
120 |
|
121 |
...
|
122 |
|
123 |
-
= After installing, why did my site
|
124 |
|
125 |
-
|
126 |
|
127 |
...
|
128 |
|
129 |
= How do I use the precompressed files with gzip_static on Nginx? =
|
130 |
|
131 |
-
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.
|
132 |
|
133 |
...
|
134 |
|
135 |
= Where is the YUI Compressor option gone to? =
|
136 |
|
137 |
-
This functionality depends on wheter you have exec and java available on your system. It will be visible on the basic Settings page under the JavaScript Options section and it
|
138 |
|
139 |
...
|
140 |
|
141 |
-
= After installing, why
|
142 |
|
143 |
-
|
144 |
-
You must disable any features on your theme and other plugins, that perform minification of css, html and js.
|
145 |
-
You cannot also have other optimization plugins, because you are forcing wordpress to do double work.
|
146 |
-
I recommend W3 Total Cache (with css, js and html minifcation disabled) + Fast Velocity Minify, for minification of CSS and JS files.
|
147 |
-
Also, kindly review the "Why are some of the CSS and JS files not being merged or why is my layout broken ?" below for better insights.
|
148 |
|
149 |
-
|
150 |
|
151 |
-
|
152 |
-
Likewise, you can keep CSS processing and disable JS processing to find out if the problem is on JS processing.
|
153 |
-
If you determine it's a CSS issue, check the log file on the status page for possible css file urls that should not be there (such as Internet Explorer only files) and add them to the ignore list.
|
154 |
-
Also kindly report those files on the support forum so they can be blacklisted for future releases.
|
155 |
-
Sometimes there are JS files than conflict with each other when merged so they may need to be excluded too.
|
156 |
|
157 |
-
|
158 |
|
159 |
-
|
160 |
-
On Google Chrome you can look at the console by pressing CTRL + SHIFT + J on your keyboard and refreshing the page. If there are errors you need to track down which JS file is causing trouble and add it to the ignore list.
|
161 |
-
If you have no idea which files to add, I recommend checking the log file on the status page, adding them all to the ignore list and then one by one trying to delete each url until you find the one causing trouble.
|
162 |
-
Also beware of any cache plugin in use (and cloudflare) when testing, because that cache needs to be off or purged when configuring things around.
|
163 |
|
164 |
...
|
165 |
|
166 |
-
= Why are some of the CSS and JS files not being merged
|
167 |
|
168 |
-
|
169 |
|
170 |
-
|
171 |
|
172 |
-
|
173 |
|
174 |
-
|
175 |
-
There are also files meant to be loaded for IE users only, mobile users, desktop users, printers, so the enqueing of all the files needs to follow the official method of enqueing data and files.
|
176 |
|
177 |
-
|
178 |
-
|
179 |
-
Please feel free to open a support topic if you found some more JS or CSS files on your theme or plugins that "must always" also blacklisted and why.
|
180 |
|
181 |
-
|
182 |
-
https://fastvelocity.com/api/fvm/ignore.txt
|
183 |
|
184 |
-
|
185 |
|
186 |
-
|
187 |
|
188 |
...
|
189 |
|
190 |
-
=
|
191 |
-
|
192 |
-
While this is 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.
|
193 |
|
194 |
-
|
195 |
|
196 |
...
|
197 |
|
198 |
-
= Why is
|
199 |
|
200 |
-
Some
|
201 |
|
202 |
-
|
|
|
|
|
203 |
|
204 |
-
|
205 |
|
206 |
-
|
207 |
|
208 |
...
|
209 |
|
210 |
-
=
|
211 |
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
If you experience some styles missing, this could be the cause... but try the ignore list first.
|
216 |
|
217 |
...
|
218 |
|
219 |
= How should I use the "Preload Images" and what is it for? =
|
220 |
|
221 |
-
Certain themes and plugins, either load large images or sliders on the homepage. Most of them will also load "above the fold" causing the "Prioritize visible content" or the "Eliminate render-blocking JavaScript and CSS in above-the-fold content" message on pagespeed insights
|
222 |
|
223 |
-
|
224 |
|
225 |
-
Don't put too many
|
226 |
|
227 |
...
|
228 |
|
229 |
= What are the recommended cloudflare settings for this plugin? =
|
230 |
|
231 |
-
On the "Speed" tab, deselect the Auto Minify for JavaScript, CSS and HTML as well as the Rocket Loader option
|
232 |
-
|
233 |
-
...
|
234 |
|
235 |
-
|
236 |
-
|
237 |
-
The plugin itself doesn't do any "changes" to your site and all original files are untouched. It intercepts the enqueued CSS and JS files, processes and hides them, while enqueuing the newly optimized cached version of those files. As with any plugin, simply disable or uninstall the plugin, purge all caches you may have in use (plugins, server, cloudflare, etc) and the site will go back to what it was before installing it. The plugin doesn't delete anything from the database or modify any of your files.
|
238 |
|
239 |
...
|
240 |
|
@@ -274,6 +256,11 @@ Note: Kindly re-save all options and purge all caches (the plugin cache as well
|
|
274 |
|
275 |
== Changelog ==
|
276 |
|
|
|
|
|
|
|
|
|
|
|
277 |
= 2.2.5 [2017.12.18] =
|
278 |
* fixed a fatal error reported on the support forum
|
279 |
|
1 |
=== Fast Velocity Minify ===
|
2 |
Contributors: Alignak
|
3 |
+
Tags: PHP Minify, YUI Compressor, GTmetrix, Pingdom, Pagespeed, CSS Merging, JS Merging, CSS Minification, JS Minification, Speed Optimization, HTML Minification, Performance
|
4 |
Requires at least: 4.5
|
5 |
+
Stable tag: 2.2.6
|
6 |
Tested up to: 4.9.1
|
7 |
License: GPLv3 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
72 |
|
73 |
= How can I exclude certain assets by wildcard? =
|
74 |
|
75 |
+
Each line on the ignore list will try to match a substring against all CSS or JS files, 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 `/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.
|
76 |
|
77 |
...
|
78 |
|
79 |
= Why is the ignore list not working? =
|
80 |
|
81 |
+
The ignore list may be working, just try to use partial paths (see wildcard help above) and use relative urls only without any query vars.
|
82 |
|
83 |
...
|
84 |
|
85 |
|
86 |
+
= Why are there several or lot's of JS and CSS files listed on the status page, or why the cache directory takes so much space? =
|
87 |
|
88 |
+
Well, some sites and themes have a combined CSS size above 1+ MB, so when you have 200 files, that's 200+ MB.
|
89 |
+
Different pages may need different JS and CSS files per page, post, category, tag, homepage or even custom post types, but if the requirements never change and you always load the exact same files on every page, you won't see as many files. Likewise, if you have some dynamic url for CSS or JS that always changes in each pageview (the query var for example), you must add it to the ignore list (else it will generate a new cache file every pageview).
|
90 |
|
91 |
...
|
92 |
|
93 |
+
= Can I update plugins and themes? =
|
94 |
|
95 |
+
Yes, but it's recommended that you purge the cache (from the plugin status page) in order for the merging and minification cache files to be regenerated and for you to be sure the updates went smoothly. The plugin will also try to automatically purge some popular cache plugins, however we still recommend that you purge all caches on your cache plugin / server (whatever you use) "after" purging Fast Velocity Minify cache.
|
96 |
|
97 |
...
|
98 |
|
99 |
= Is it compatible with other caching plugins? =
|
100 |
|
101 |
+
You must disable any features on your theme or cache plugins, that perform minification of css, html and js.
|
102 |
The plugin will try to automatically purge several popular cache plugins, however we still recommend you to purge all caches (on whatever you use) if you also manually purge the cache on the plugin settings for some reason.
|
103 |
The automatic purge is active for the following plugins and hosting: W3 Total Cache, WP Supercache, WP Rocket, Wp Fastest Cache, Cachify, Comet Cache, Zen Cache, LiteSpeed Cache, SG Optimizer, Godaddy Managed WordPress Hosting and WP Engine
|
104 |
|
106 |
|
107 |
= Is it resource intensive, or will it use too much CPU on my shared hosting plan? =
|
108 |
|
109 |
+
No it's not. On the first run, each single file is minified into an intermediate cache. When a new group of files is found, it reuses those files and merges them into a new static cache file. All pages that request the same group of CSS or JS files will also make use of that file.
|
110 |
|
111 |
...
|
112 |
|
122 |
|
123 |
...
|
124 |
|
125 |
+
= After installing, why did my site feels slow to load? =
|
126 |
|
127 |
+
The cache regeration happen's once per url or if the included CSS + JS files change. If you need the same set of CSS and JS files in every page, the cache file will only be generated once and reused for all other pages, however if you have a CSS or JS that is generated dynamically and uses a time based query string, (url changes on every pageview), you must add it to the ignore list by wildcard.
|
128 |
|
129 |
...
|
130 |
|
131 |
= How do I use the precompressed files with gzip_static on Nginx? =
|
132 |
|
133 |
+
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.
|
134 |
|
135 |
...
|
136 |
|
137 |
= Where is the YUI Compressor option gone to? =
|
138 |
|
139 |
+
This functionality depends on wheter you have exec and java available on your system and PHP can detect it or not. It will be visible on the basic Settings page under the JavaScript Options section and it's available for JS files only.
|
140 |
|
141 |
...
|
142 |
|
143 |
+
= After installing, why are some images and sliders not working? =
|
144 |
|
145 |
+
a) You cannot do double minification as it will break things, so make sure you have disabled any features on your theme or other plugins, that perform minification of css, html and js files.
|
|
|
|
|
|
|
|
|
146 |
|
147 |
+
b) Are you trying to use the defer JS or CSS options, without understanding exactly how it works? Be advised that most themes do not work properly with those options on.
|
148 |
|
149 |
+
c) The plugin relies on PHP Minify to minify javascript and css files, however it's not a perfect library and there are plugins that are already minified and do not output a min.js or min.css name and end up being minified again. Try to disable minification on JS and CSS files and purge the cache.
|
|
|
|
|
|
|
|
|
150 |
|
151 |
+
d) Sometimes a plugin conflicts with another when merged. Try to disable CSS processing first and see if it works. Try to disable JS processing second and see if it works. Try to disable HTML minification last and see if it works. If one of those work, you know there's a conflict.
|
152 |
|
153 |
+
e) If you have a conflict, try to add each CSS and each JS to the ignore list, one by one until you find the one that causes the conflict. If you have no idea which files to add, check the log file on the status page for a list of files.
|
|
|
|
|
|
|
154 |
|
155 |
...
|
156 |
|
157 |
+
= Why are some of the CSS and JS files not being merged ? =
|
158 |
|
159 |
+
The plugin only processes (same domain) JS and CSS files enqueued using the official method outlined here: https://developer.wordpress.org/themes/basics/including-css-javascript/
|
160 |
|
161 |
+
Some developers enqueue all files properly but may still "print" conditional tags directly in the header, while they should be following the example as explained on the codex: https://developer.wordpress.org/reference/functions/wp_script_add_data/
|
162 |
|
163 |
+
Because "printing CSS and JS tags on the header and footer is evil" (seriously), we cannot capture those files and merge them together.
|
164 |
|
165 |
+
There are also specific ways to enqueue files meant to be loaded for IE users only, mobile users, desktop users, printers, etc, else those may be merged together and break things. There is a blacklist and default ignore list on the PRO tab because of this.
|
|
|
166 |
|
167 |
+
...
|
|
|
|
|
168 |
|
169 |
+
= How can I load CSS async, get the critical path or why is there a flash of unstyle content when I enable this? =
|
|
|
170 |
|
171 |
+
This is an advanced option for highly skilled developers. Do not try to fiddle with these settings if you are not one, as it will almost certainly break your site layout and functionality.
|
172 |
|
173 |
+
Loading CSS async only works properly and consistently, when you have one single CSS file being generated and your critical path is generic enough to be common on all pages.
|
174 |
|
175 |
...
|
176 |
|
177 |
+
= How to undo all changes done by the plugin? =
|
|
|
|
|
178 |
|
179 |
+
The plugin itself doesn't do any "changes" to your site and all original files are untouched. It intercepts the enqueued CSS and JS files, processes and hides them, while enqueuing the newly optimized cached version of those files. As with any plugin, simply disable or uninstall the plugin, purge all caches you may have in use (plugins, server, cloudflare, etc) and the site will go back to what it was before installing it. The plugin doesn't delete anything from the database or modify any of your files.
|
180 |
|
181 |
...
|
182 |
|
183 |
+
= Why is it that even though I have disabled or deleted the plugin, the design is still broken? =
|
184 |
|
185 |
+
Some "cheap" or so called "optimized" hosting providers, implement a misconfigured and agressive cache on their servers, and then are also "smart" enough to ignore your multiple cache purge requests if those are too frequent.
|
186 |
|
187 |
+
Some providers use a "deploy system", where you upload / replace / delete the files via sftp, but those are not reflected on the live site immediatly. This means that in some cases, you can delete your whole wordpress instalation via sftp, and the site still works perfectly fine even after purging the cache.
|
188 |
+
|
189 |
+
You may have deleted the physical files from the disk, but that's either just some random storage they gave you and that they sync to the main server every few hours, or it may be the actual live server but with a file cache layer on top of it (so the old code keeps running even though you have deleted the files).
|
190 |
|
191 |
+
The only solution is to contact your hosting company and ask them why you have deleted the plugin and purged your cache, but the live site doesn't reflect the changes.
|
192 |
|
193 |
+
Providers well known to have this issue are hostgator and iPage (please report others if you find them).
|
194 |
|
195 |
...
|
196 |
|
197 |
+
= Why is my Visual Composer, or Page Editor not working ? =
|
198 |
|
199 |
+
Some plugins and themes need to edit the layout and styles on the frontend. When they need to do that, they enqueue several extra js and css files that are caught by this plugin and get merged together, when in fact those need to load seperatly. If you encounter such issue of your page editor not working on the frontend, kindly enable the "Fix Page Editors" and purge your caches.
|
200 |
+
|
201 |
+
This option hides all optimization from logged in users, so it's as iff the plugin has been disabled. Not logged in users and search engines, still see the optimized version.
|
|
|
202 |
|
203 |
...
|
204 |
|
205 |
= How should I use the "Preload Images" and what is it for? =
|
206 |
|
207 |
+
Certain themes and plugins, either load large images or sliders on the homepage. Most of them will also load "above the fold" causing the "Prioritize visible content" or the "Eliminate render-blocking JavaScript and CSS in above-the-fold content" message on pagespeed insights.
|
208 |
|
209 |
+
While this may not work when the images are large, you can use the "Preload Images" for the first relevant images that load above the fold, such as the logo or the first image of a slider. Please note however, this is for images that show up in all pages, not just the homepage.
|
210 |
|
211 |
+
Don't put too many images here as those are downloaded in high priority and it will slow down the rest of the page load.
|
212 |
|
213 |
...
|
214 |
|
215 |
= What are the recommended cloudflare settings for this plugin? =
|
216 |
|
217 |
+
On the "Speed" tab, deselect the Auto Minify for JavaScript, CSS and HTML as well as the Rocket Loader option as there is no benefit of using them with our plugin (we already minify things).
|
|
|
|
|
218 |
|
219 |
+
Those options can also break the design due to double minification or the fact that the Rocket Loader is still experimental (you can read about that on the "Help" link under each selected option on cloudflare).
|
|
|
|
|
220 |
|
221 |
...
|
222 |
|
256 |
|
257 |
== Changelog ==
|
258 |
|
259 |
+
= 2.2.6 [2018.01.06] =
|
260 |
+
* fixed a bug with html minification on some files that should not be minified
|
261 |
+
* fixed a bug with the defer for pagespeed insights
|
262 |
+
* updated the default blacklist (delete all entries and save again, to restore)
|
263 |
+
|
264 |
= 2.2.5 [2017.12.18] =
|
265 |
* fixed a fatal error reported on the support forum
|
266 |
|