Skip to content

Asset minification and versioning library for CodeIgniter 4

License

Notifications You must be signed in to change notification settings

michalsn/minifier

Repository files navigation

Minifier

Asset minification and versioning library for CodeIgniter 4.

PHPUnit PHPStan Deptrac Coverage Status

PHP CodeIgniter

Installation

composer require michalsn/minifier

Configuration

Run command:

php spark minify:publish

This command will copy a config file to your app namespace. Then you can adjust it to your needs. By default, file will be present in app/Config/Minifier.php.

You should define an array of files that you want to minify, ie:

public $js = [
    'all.min.js' => [
        'jquery-3.7.1.min.js', 'bootstrap-3.3.7.min.js', 'main.js',
    ]
];

// or / and

public $css = [
    'all.min.css' => [
        'bootstrap-3.3.7.min.css', 'font-awesome-4.7.0.min.css', 'main.css',
    ]
];

This way requesting for a all.min.js or all.min.css file will return a minified and combined version of all files in a given array.

Docs

Read the full documentation: https://michalsn.github.io/minifier/