michalsn/minifier

Assets minification and versioning library for CodeIgniter 4.

v2.0.0 2023-12-27 12:32 UTC

This package is auto-updated.

Last update: 2024-11-18 02:15:27 UTC


README

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/