CodeIgniter Forums

Full Version: Minifier - asset minification and versioning library
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2


composer require michalsn/minifier


PHP Code:
public $js = [
'all.min.js' => [
php spark minify:js


PHP Code:
<?= minifier('all.min.js'); ?>
// will produce
// <script type="text/javascript" src="http://localhost/assets/js/all.min.js?v=9ef881911da8d7c4a1c2f19c4878d122"></script> 
It looks useful. Thanks!

In what file do I need to write "public $js = [...]"?
It's in the "Config/Minifier.php" file. You can run command:
php spark minify:publish

to copy the default config file to your application and then modify it to your needs.

i tried this library

and used the installation via composer

but the function Minifier() is not found

"Call to undefined function Minifier()"

do you know how to fix it

Hi Paul,

You probably need to load a helper in your controller

yes that works

this package is good but maybe the Dir config will be upgrade

for me the URL to css is and the dir to css file in php is ../system/assets/css/mycss.css

i think the four parameters $baseUrl, $dirJs, $dirCss, $dirVersion would be changed by $UrlJS, $UrlCss, $dirJs, $dirCss, $dirVersion

what do you think of that
Well, yes... separate URL config like $cssUrl and $jsUrl might be a good addition if someone would like to serve these files from a separate domain.

Thanks for the idea.
yes and i think it's useful if the public directory is not at the same level of the assets directory
I tried used this package in manual installation mode and all the command php spark minify:* are not found

do you know how to fix it
Pages: 1 2