This post will explain the various options in WP Minify WordPress plugin.
Basic Options
Enable JavaScript Minification
When checked, all JavaScript files will be extracted from the HTML output and be minified and served as one compressed JavaScript file.
Enable CSS Minification
When checked, all CSS files will be extracted from the HTML output and be minified and served as one compressed CSS file.
Enable HTML Minification
When checked, your HTML output will also be minified.
JavaScript files to exclude from minify
You may specify any patterns for excluding any Javascript files from the Minifying process. The entries are line delimited so if you specify:
prototype wp-greet-box/js googlecode.com |
Then the following Javascript files will not get included into the Minifying process if it’s being enqueued via wp_enqueue_script():
- http://example.com/wp-includes/js/prototype.js
(matching first rule) - http://example.com/wp-content/plugins/wp-greet-box/js/functions.js
http://example.com/wp-content/plugins/wp-greet-box/js/onload.js
(matching second rule) - http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js
(matching third rule)
CSS files to exclude from minify
Works the same way as the “JavaScript files to exclude from minify” option except that this field will filter out CSS files.
Advanced Options
Enable Minification on External Files
WP-Minify supports minification of external JavaScript and CSS files by downloading, caching, and feeding them to the minify engine. Although this helps speed things up considerably, there is a good chance that external JavaScripts will not work when downloaded. I wouldn’t recommend enabling this option unless you know what you’re doing and I want to add a bunch of excludes to the JavaScript exclusion list.
Manual JavaScript and CSS Placement
You can specify where you would like your minified JavaScript or CSS files to show up in your source. Just specify the following HTML comments wherever you would like your minified JavaScript and CSS to show up:
<!-- WP-Minify JS --> <!-- WP-Minify CSS --> |
This setting will override default header or footer placements of minified JavaScript and CSS files.
Place Minified JavaScript in footer
If you don’t feel like modify your theme to include the tags above, you may just enable this to include JavaScript in your footer. Moving scripts to the footer is not recommended if you have embedded JS code referring to code that’s been minified
Force all JavaScript/CSS calls to be HTTPS on HTTPS pages
It does exactly what it sounds like.
Debugging by using “wp-minify-off=1″
If you pass, “wp-minify-off=1″ in your URL, WP Minify is effectively turned off.
Combine files but do not minify (Debug mode)
When checked, all Javascript and CSS files will still get merged into one file, but they will not be minified (i.e. spaces removed, etc). Comments will also be added to each line telling you what line number each line is. That way, you can easily troubleshoot any Javascript or CSS errors.
Debug off
WP Minify will embed a URL like the following:
http://omninoggin.com/wp-content/plugins/wp-minify/min/?f=www/wp-content/themes/omninoggin/onload.js |
which will return the minified version of the script:
Debug on
WP Minify will embed a URL like the following (notice the &debug=true at the end):
http://omninoggin.com/wp-content/plugins/wp-minify/min/?f=www/wp-content/themes/omninoggin/onload.js&debug=true |
which will return the non-minified version of the script:
Show minify errors through FirePHP (Debug mode)
This lets you figure out which script is breaking minify. Check out the tutorial here: Troubleshooting WP Minify with FirePHP
Cache Expiration
WP Minify caches all external Javascript and CSS files that get queued via wp_enqueued_script() and wp_enqueue_style() functions. This setting lets you set the cache expiration policy and also lets you clear the cache on demand.
External JavaScript files to include into minify
This option is only useful if you are NOT minifying external files (see a few options above). You may specify patterns to match any additional JavaScript files to be included in the minifying process here. The entries are line delimited, so you can specify them in the following manner:
file1.js file2.js file3.js |
WP Minify will search the HTML source and extract/minify the matching JavaScript declarations even if they are external files. For example, if the in your header.php, you declare:
<script type="text/javascript" src="http://someone-elses-site/file1.js"/> |
And you place “file1.js” in the include box, the script “http://someone-elses-site/file1.js” will be downloaded, cached local to your server, and minified along with other JavaScript files on your server.
External CSS files to include into minify
Works the same way as the “External JavaScript files to include into minify” option except that this field expects patterns to match CSS.
Extra arguments to pass to minify engine
This value will get append to calls to URL “wp-minify/min/?f=file1.js,file2.js,…,fileN.js”. I wouldn’t touch this unless you know the Minify engine API pretty well.
commented on April 14th, 2009 at 11:29 am
sounds awesome for the lazy man with in me! will give it a shot!
commented on April 15th, 2009 at 6:01 am
Great! Please let me know how it works out for you.
commented on May 3rd, 2009 at 5:17 am
I commented in the other post but found this one.
Excluding JS worked but the CSS is still being minified.
The only problem is
wp-greet-box/css
isn't being recognised. Cant get the css to work…
commented on May 13th, 2009 at 7:23 am
Warning: main(/homez.116/goonline/www/wp-content/plugins/min/) [function.main]: failed to open stream: Success in /homez.116/goonline/www/wp-settings.php on line 473
Warning: main() [function.include]: Failed opening '/homez.116/goonline/www/wp-content/plugins/min/' for inclusion (include_path='.:/usr/local/lib/php') in /homez.116/goonline/www/wp-settings.php on line 473
what should I do ?
commented on May 13th, 2009 at 7:27 am
And how can I disable this plug-in ?
commented on May 13th, 2009 at 8:36 am
Renaming the folder wp-minify to something else should disable the plugin.
commented on May 13th, 2009 at 8:36 am
Please post in the forum.
commented on May 17th, 2009 at 5:36 pm
Lock up this comment thread so people can post support questions in the support forum.