We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Jsmin and Cssmin not generate minified file !

Someone managed to use the filters minification of javascript and stylesheets (\Phalcon\Assets\Filters\Jsmin and \Phalcon\Assets\Filters\Cssmin)?

I tried numerous times, recompile the Phalcon, according to the tips on this topic this: https://forum.phalcon.io/discussion/3637/phalcon-assets-filters-jsmin-non-free-jsminifier-not-available

$this->assets->collection('javascripts')
->addJs('style.js')
->setTargetPath('production.js')
->setTargetUri('production.js')
->addFilter(new Phalcon\Assets\Filters\Jsmin());

I can not generate the final file with all the minified content, neither filters seems to work!

Use the Phalcon 1.3.4! Anyone have any tips?

Thanks !



33.8k

I see in the docs that you forgotted to add ->join(true) before the filters (maybe?) ( https://docs.phalcon.io/en/latest/reference/assets.html#minification-filtering ).



1.4k
edited Jan '15

Indeed, unfortunately ->join (true) does not work even so! also does not throw any exception !



33.8k

Maybe adding the files after setting the paths...



1.4k
Accepted
answer
edited Jan '15

RompePC, I really appreciate your help, but the error was totally mine, to generate my final file, i forgot to define which collection should be set! For example:

$this->assets->outputJs (); // Not generate final file
$this->assets->outputJs ('my_collection_name'); // Generate correctly

Thanks !



33.8k

xD

Mark your answer as an accepted answer then.