We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

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: http://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.7k

I see in the docs that you forgotted to add ->join(true) before the filters (maybe?) ( http://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.7k

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.7k

xD

Mark your answer as an accepted answer then.