Minit Update: Better Cache Purge and a Filter to Exclude Files

I have updated the Minit plugin to include the following improvements:

Purging cache will no longer delete files in the Minit cache folder. Instead, it will bump a global version number that is used when generating Minit cache keys. This will ensure that users don’t get 404 errors on heavily cached sites for files that haven’t been regenerated yet. Cache files can still be deleted by calling do_action( 'minit-cache-purge-delete' ); from cron, for example.

Ability to exclude files from being concatenated using a filter:

add_filter( 'minit-exclude-js', 'exclude_my_file' );
add_filter( 'minit-exclude-css', 'exclude_my_file' );

function exclude_my_file( $exclude ) {
	// ID of the script that was enqueued
	$exclude[] = 'admin-bar';

	return $exclude;


  1. Hi, I really like the minit plugin and it works great. I do have a couple of questions.

    1. Will it work well with other caching plugins like wp super cache?
    2. I noticed it creates a lot of Transients, will a future release automatically delete expired transients?
    3. Is it possible to delete minified files that have been expired after say 10 days?

    I know I ask a lot but would love to use this plugin in all of my projects. Thanks.

    • Kaspars says:

      1. Yes, Minit should work just fine with other plugins as long as you don’t enable competing concatenation functionality that is provided by W3 Total Cache, for example.

      2. Transients are used only for caching the list of enqueued files and their versions and have an expiry of 24 hours. Currently WordPress doesn’t remove the expired transients automatically so you must use a plugin such as Transient Cleaner or Delete Expired Transients to do that.

      3. It is not possible to delete “expired” files because there is no reliable way of knowing that they have actually expired and will never be used again. You could add a cron job that deletes cache files that are older than a week or leaves everything but the 50 latest files in the cache folder.

  2. Luyen says:

    Hi Kaspars, thanks for your plugin and how light-weight it is. Is there any future features so that you can exclude CSS / JS files from the WP Admin UI?

    I think this would be a great feature simply because i noticed that themes can often break when files are concatenated and the only solution is to exclude files.

    • Kaspars says:

      Themes shouldn’t be adding styles and scripts to the admin area of WordPress. The default behaviour of wp_enqueue_scripts hook is to fire only on the front-end.

      Or maybe you’re referring to the functionality of this plugin — in that case, Minit is meant to be used with well designed WordPress themes and plugins and therefore doesn’t include an admin panel.

  3. Annie says:


    I would I go if I wanted to exclude plugin script? By default, they do not have ID.

    Thanks a lot!

    • Kaspars says:

      All styles and scripts that are added using wp_enqueue_script() and wp_enqueue_style() must have an ID or handle. Minit only works with assets that are enqueued using these two methods.

Leave a Reply