When developing or maintaining a WordPress (or any) website, it’s important to rein in the amount of JavaScript and CSS files that are included in your site and delivered to the end user. Too many files, poorly optimized files or improper load order will slow down your site and negatively affect your Search Engine Optimization efforts.

Optimize Scripts & Styles is a free WordPress plugin developed by Seismic Pixels that optimizes your site’s JavaScript and CSS files by combining, minifying and caching them in your site’s content folder. In conjunction with a site caching plugin, this will ensure your pages load fast and your customers are more likely to stay engaged.

FEATURES

  • Combine & minify all JavaScript & CSS that is enqueued
  • Stores the optimized files in the cache folder for faster page loads
  • Compatible with caching plugins like WP Super Cache and W3 Total Cache
  • Enable for logged in users (not recommended)
  • Available options to remove or ignore enqueued scripts and styles
  • Optional button in the admin bar to clear scripts and styles
  • Includes an option to remove script type attributes for HTML5 validation

SCREENSHOTS

Enjoy the plugin? Let us know and buy a cup of coffee. Here at Seismic Pixels, we develop custom WordPress websites, one-off themes, custom plugins and more. Take a look at all of our services.

CHANGELOG

1.9.5

  • PHP 8.3 compatibility
  • Updated minify package to 1.3.73
  • Added better recursion for JavaScript dependencies
  • Added better handling of localized scripts before & after JavaScript
  • Added handling for async and defer scripts, retaining their intended loading strategy
  • Code refactoring

1.9.4

  • PHP 8.2 compatibility
  • Updated minify package to 1.3.71
  • Fixed a bug with stylesheet dependencies

1.9.3

  • Added recursive stylesheet dependency inclusion
  • Better code comments

1.9.2

  • Fixed an issue with the HTML5 text/css feature inadvertently converting link tags to script tags

1.9.1

  • [New Feature] Added an option to enable/disable caching. Turn caching off to process scripts on every page load in order to debug potential script or style conflicts.
  • [New Feature] Added a cache lifespan option. If your site doesn’t change often, it would be beneficial to choose the Manually Refresh option.
  • [New Feature] Added the ability to output script info on the front end of the site. Make sure to disable this for production environments.
  • Fixed a bug with the optimization behavior select not having a previous value
  • Verified compatibility up to WordPress 5.5

1.9.0

  • [New Feature] Added an option to minify OR concatenate only. This could be helpful when trying to track down any issues sites may have due to optimization.
  • Updated minification library to the latest version. Fixes a few bugs.

1.8.9

  • Fixed an unset variable error for remove_script_type and remove_style_type
  • Verified WordPress 5.0/Gutenberg compatibility. Optimize Scripts & Styles will work along-side the Gutenberg blocks scripts, but the Gutenberg blocks handle their own enqueue, concatenation and minification.

1.8.8

  • Tweaked localized script output to only remove the type=’text/javscript’ if that option is set in the admin
  • Added location (header or footer) to the cached files description
  • The plugin no longer initializes on AJAX requests
  • Added a hash to the script handles to allow them be unique. This fixed a problem with Gravity Forms using AJAX

1.8.7

  • [New Feature] Added an option to remove type=’text/javscript’ from script tags so that HTML5 sites can be W3C compliant (other optimizations may be needed)
  • [New Feature] Added an option to remove type=’text/css’ from style tags so that HTML5 sites can be W3C compliant (other optimizations may be needed)
  • [New Feature] Added an option to REMOVE scripts and/or styles. Add script or style handles to the list and they will no longer load for the site
  • Modified the Clear Optimize Scripts action to better handle a variety of existing query string formats
  • Removed the type=’text/javscript’ that SPOS scripts output for localized data
  • Cosmetic udpates to the admin area
  • Added a Refresh button to the cached files area for easier testing

1.8.6

  • Fixed a bug with the Clear Optimized Scripts button in the admin bar not having the correct link when viewing the admin via SSL but having a non-SSL front-end to the site

1.8.5

  • Added activation message to remind admins to enable the options
  • Added a check for file extensions to make sure only css and js files are included
  • Changed the order to include optimized styles before all ignored styles
  • Separated the Ignore Settings to provide a better description for usage

1.8.4

  • Fixed a bug that output duplicate localized data
  • Changed menu title to Optimization

1.8.3

  • Updating missing SVN files

1.8.2

  • Optimize Scripts & Styles now has an admin screen under Settings!
  • On/off for scripts optimization
  • On/off for styles optimization
  • On/off to enable optimization for logged in users
  • On/off to show the Clear Optimized Scripts quick link in the admin header
  • Added the ability to ignore specific scripts
  • Added the ability to ignore specific styles
  • The admin page has a Delete Cache button
  • Added a section to view cached scripts for debug & fine-tuning
  • Added a section to view cached styles for debug & fine-tuning
  • Removed gzip – this should be done in the .htaccess file if possible
  • Removed a default exclusion of a Visual Composer stylesheet
  • Added a check for all styles being ignored. A flag file will no longer be generated

1.8.1

  • Changed absolute paths to use WordPress’ built in features
  • Added better cache clearing for W3 Total Cache & WP Super Cache

1.8

  • Major update in the way header/footer scripts are managed
  • Much more reliable in making sure everything gets loaded in the right place
  • Added .txt to flag files to make it easier to open them
  • Added comment to footer when not logged in

1.7

  • Added comment to footer when logged in
  • Changed script version in wp_register to match filemtime to encourage caching/refreshing in browsers

1.6

  • Disabled for logged in users
  • Fixed an issue where the script wasn’t ignoring css files that were in $ignore
  • Added js_composer_front to ignore since it’s causing an issue with minification

1.5

  • Major update
  • Added better support to catch javascript in the footer via two separate functions/hooks

1.4

  • Cleaned up files
  • Added minify! (always on)
  • Added gzip (turned off – still testing)

1.3
Added check for file_get_contents http wrapper

1.2
Added in support for conditional stylesheets

Would you like to see a new feature or need to report a bug? Use our contact form to describe your feature request or issue and we’ll be happy to take a look.