Automatically concatenates and minifies any scripts and stylesheets enqueued using the standard dependency system.
Contributors: x-team, westonruter, fjarrett, kucrut, shadyvb, alex-ye, c3mdigital, lkraav
Tags: performance, dependencies, minify, concatenate, compress, js, javascript, scripts, css, styles, stylesheets, gzip, yslow, pagespeed, caching
Requires at least: 3.5
Tested up to: 3.8
Stable tag: trunk (master)
License: GPLv2 or later
This plugin takes all scripts and stylesheets that have been added via wp_enqueue_script
and wp_enqueue_style
and automatically concatenates and minifies them into logical groups. For example, scripts in the footer get grouped
together and styles with the same media (e.g. print
) get minified together. Minification is done via WP-Cron in order
to prevent race conditions and to ensure that the minification process does not slow down page responses.
This is a reincarnation and rewrite of the Optimize Scripts plugin, which this plugin now supersedes.
Features:
/_minified
, which can be configured.dependency_minification_excluded
filter.default_exclude_remote_dependencies
option via the dependency_minification_options
filter, or on a case-by-case basis via the filter previously mentioned.dependency_minification_excluded
filter.cache_control_max_age_cache
option.show_error_messages
option is enabled; such errors are enabled by default if WP_DEBUG
.cache_control_max_age_error
) to prevent back-to-back crons from continually attempting to minify in perpetuity.Last-Modified
and ETag
responses headers and requests will honor If-None-Match
and If-Modified-Since
to return 304 Not Modified
responses (configurable via the allow_not_modified_responses
option).wp_localize_script
) is also concatenated together and attached to the newly-minified script.gzip
or deflate
.Development of this plugin is done on GitHub. Pull requests welcome. Please see issues reported there before going to the plugin forum.
If you are using Nginx with the default Varying Vagrant Vagrants config, you'll want to remove css|js
from this rule in nginx-wp-common.conf
(or remove the rule altogether):
# Handle all static assets by serving the file directly. Add directives
# to send expires headers and turn off 404 error logging.
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires 24h;
log_not_found off;
}
Improve how the plugin guesses the sources' absolute paths (#34). Props alex-ye.
Improve network activation and deactivation (#37). Props kucrut.
Fix wp_localize_script data lost in minification (#28). Props lkraav.
Issue warning if pretty permalinks are not enabled (#16). Props shadyvb.
Prevent default built-in scripts from breaking minification groups (#9). Props shadyvb.
Show alert if WP_DEBUG is disabling dependency minification (#12). Props c3mdigital.
Add a settings link to the list of plugin action links (#13). Props fjarrett.
First Release