Asset minification and versioning library for CodeIgniter 4.
composer require michalsn/minifier
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.
Read the full documentation: https://michalsn.github.io/minifier/