Skip to content
A WordPress plugin to combine CSS and Javascript files.
Branch: master
Clone or download
Latest commit b4b35df Dec 22, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.editorconfig
.gitignore
.travis.yml
LICENSE
composer.json
composer.lock Lock scripts Dec 21, 2018
minit.php
phpcs.xml Skip comments for now Dec 21, 2018
readme.md Space it out Dec 21, 2018
screenshot-1.png
screenshot-2.png

readme.md

Minit for WordPress

Install

Install using Composer:

composer require kasparsd/minit

or by manually downloading the latest release file.

How it Works

  • Concatenates all CSS files and Javascript files one file for each type, and stores them in the WordPress uploads directory under /minit. See the configuration section below for how to exclude files from the bundle.

  • Uses the combined version numbers of the enqueued assets to version the concatenated files.

  • Loads the concatenated Javascript file asynchronously in the footer. This will probably break all inline scripts that rely on jQuery being available. See the configuration section below for how to disable this.

  • Loads all external Javascript files asynchronously in the footer of the page.

Screenshots

  1. All CSS files combined in a single file
  2. All external Javascript files loading asynchronously

Configuration

See the Wiki for additional documentation.

Disable Asynchronous Javascript

Use the minit-script-tag-async filter to load the concatenated Javascript synchronously:

add_filter( 'minit-script-tag-async', '__return_false' );

Exclude Files

Use the minit-exclude-js and minit-exclude-css filters to exclude files from the concatenated bundles:

add_filter( 'minit-exclude-js', function( $handles ) {
    $handles[] = 'jquery';

    return $handles;
} );

Minit Addons

Credits

Created by Kaspars Dambis and contributors.

You can’t perform that action at this time.