PHPackages                             kasparsd/minit - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. kasparsd/minit

ActiveWordpress-plugin[Utility &amp; Helpers](/categories/utility)

kasparsd/minit
==============

A WordPress plugin to combine CSS and Javascript files

3.2.0(5mo ago)28138742[6 issues](https://github.com/kasparsd/minit/issues)[2 PRs](https://github.com/kasparsd/minit/pulls)GPL-2.0-or-laterPHPPHP &gt;=7.4CI passing

Since Dec 21Pushed 5mo ago29 watchersCompare

[ Source](https://github.com/kasparsd/minit)[ Packagist](https://packagist.org/packages/kasparsd/minit)[ Docs](https://github.com/kasparsd/minit)[ RSS](/packages/kasparsd-minit/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (10)Dependencies (10)Versions (10)Used By (0)

Minit for WordPress
===================

[](#minit-for-wordpress)

[![Test](https://github.com/kasparsd/minit/actions/workflows/test.yml/badge.svg)](https://github.com/kasparsd/minit/actions/workflows/test.yml)

Places all your CSS and Javascript files into dedicated bundles that can be cached by browsers and re-used between requests. It assumes that a single request with slightly larger transfer size is more performant than multiple smaller requests (even with HTTP/2 multiplexing).

Install
-------

[](#install)

Install [using Composer](https://packagist.org/packages/kasparsd/minit):

```
composer require kasparsd/minit

```

or by manually downloading the [latest release file](https://github.com/kasparsd/minit/releases/latest).

How it Works
------------

[](#how-it-works)

- Concatenates all CSS files and Javascript files one file for each type (`.js` and `.css`), 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 bundles.
- Loads the concatenated Javascript file in the footer as deferred. This will probably break all inline scripts that rely on jQuery being available. See the configuration section below for how to disable this.

Screenshots
-----------

[](#screenshots)

1. [All CSS files combined in a single file](screenshot-1.png)
2. [All external Javascript files loading asynchronously](screenshot-2.png)

Configuration
-------------

[](#configuration)

See the [Wiki](https://github.com/kasparsd/minit/wiki) for additional documentation.

### Disable Deferring Javascript

[](#disable-deferring-javascript)

Use the `minit-script-tag-async` filter (legacy name when async was preferred) to load the concatenated Javascript synchronously:

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

```

### Exclude Files

[](#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, $enqueued ) {
    $handles[] = 'jquery';

    return $handles;
}, 10, 2 );

```

where `$handles` is an array of handles to exclude, and `$enqueued` is an array of all enqueued handles of the given type.

### Integrate with Block Themes

[](#integrate-with-block-themes)

Full block-based themes enqueue the individual stylesheets [only for the blocks that are required for the current request](https://github.com/WordPress/wordpress-develop/blob/b42f5f95417413ee6b05ef389e21b3a0d61d3370/src/wp-includes/global-styles-and-settings.php#L320-L339). This leads to bundles being unique between requests thus defeating the purpose or cache re-use. Use the [`should_load_separate_core_block_assets` filter](https://developer.wordpress.org/reference/hooks/should_load_separate_core_block_assets/) to enqueue a single `block-library` stylesheet instead on all requests:

```
add_action(
    'plugins_loaded',
    function () {
        if ( class_exists( 'Minit_Plugin' ) ) {
            // Add late to override the default behaviour.
            add_filter( 'should_load_separate_core_block_assets', '__return_false', 20 );
        }
    },
    100 // Do it after all plugins are loaded.
);

```

### Minify CSS

[](#minify-css)

Use this filter to apply basic CSS minification to the created bundle:

```
add_filter(
    'minit-content-css',
    function ( $css ) {
            $css = preg_replace( '/[\n\r\t]/mi', ' ', $css ); // Line breaks to spaces.
            $css = preg_replace( '/\s+/mi', ' ', $css ); // Multiple spaces to single spaces.

            return $css;
    },
    5 // Do it before the debug comment in the head.
);

```

Minit Addons
------------

[](#minit-addons)

- [Minit-Pro](https://github.com/markoheijnen/Minit-Pro)
- [Minit Cron Purge](https://github.com/ryanhellyer/minit-cron-purge)
- [Minit Cache Bump](https://github.com/ryanhellyer/minit-cache-bump)
- [Minit CDN](https://github.com/LQ2-apostrophe/minit-cdn)
- [Minit Manual Inclusion](https://github.com/dimadin/minit-manual-inclusion)

Contribute
----------

[](#contribute)

Requirements:

- Docker
- Node.js
- Composer

To setup the development environment:

1. Clone this repository.
2. Run `npm install` to install the dependencies (which also runs `composer install`).
3. Run `npm run start` to start the included WordPress development environment.
4. Run `npm run test` and `npm run lint` to run the tests.

Credits
-------

[](#credits)

Created by [Kaspars Dambis](https://kaspars.net) and [contributors](https://github.com/kasparsd/minit/graphs/contributors).

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance69

Regular maintenance activity

Popularity33

Limited adoption so far

Community25

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 91.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~315 days

Recently: every ~21 days

Total

9

Last Release

173d ago

Major Versions

1.6.0 → 2.0.02025-08-27

2.0.0 → 3.0.02025-11-14

PHP version history (2 changes)1.4.0PHP &gt;=5.4.0

3.0.0PHP &gt;=7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/92bfcd3a8c3a21a033a6484d32c25a40b113ec6891f674336081513d5c98ef76?d=identicon)[kasparsd](/maintainers/kasparsd)

---

Top Contributors

[![kasparsd](https://avatars.githubusercontent.com/u/169055?v=4)](https://github.com/kasparsd "kasparsd (204 commits)")[![szepeviktor](https://avatars.githubusercontent.com/u/952007?v=4)](https://github.com/szepeviktor "szepeviktor (9 commits)")[![zytzagoo](https://avatars.githubusercontent.com/u/46947?v=4)](https://github.com/zytzagoo "zytzagoo (4 commits)")[![abumalick](https://avatars.githubusercontent.com/u/8377185?v=4)](https://github.com/abumalick "abumalick (1 commits)")[![thomasmb](https://avatars.githubusercontent.com/u/295293?v=4)](https://github.com/thomasmb "thomasmb (1 commits)")[![nigrosimone](https://avatars.githubusercontent.com/u/310077?v=4)](https://github.com/nigrosimone "nigrosimone (1 commits)")[![dimadin](https://avatars.githubusercontent.com/u/2678421?v=4)](https://github.com/dimadin "dimadin (1 commits)")[![markoheijnen](https://avatars.githubusercontent.com/u/262877?v=4)](https://github.com/markoheijnen "markoheijnen (1 commits)")

---

Tags

concatenationcssjsperformancephpwordpresswordpress-pluginwordpresscssperformanceJSminifyoptimizationpluginsspeedcombineconcatenate

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/kasparsd-minit/health.svg)

```
[![Health](https://phpackages.com/badges/kasparsd-minit/health.svg)](https://phpackages.com/packages/kasparsd-minit)
```

###  Alternatives

[stolz/assets

An ultra-simple-to-use assets management library

296519.2k8](/packages/stolz-assets)[jalle19/php-yui-compressor

A modern PHP wrapper for the YUI compressor

17972.2k3](/packages/jalle19-php-yui-compressor)[sensiolabs/minify-bundle

Assets Minifier (CSS, JS) for Symfony &amp; Minify integration in Asset Mapper

5694.9k1](/packages/sensiolabs-minify-bundle)[fisharebest/laravel-assets

Asset management for Laravel

208.1k](/packages/fisharebest-laravel-assets)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
