How to setup a minify CSS or JS in Phalcon?

I'm following this tutorial: http://docs.phalconphp.com/en/latest/reference/assets.html

And this is my implement code:

$this->assets
    ->collection('header')
    ->addCss($config->static->url . '/css/font-awesome.min.css', false)
    ->addCss($config->static->url . '/css/bcdcnt.css', false)
            ->setTargetPath('final.css')
            ->join(true)
            ->setTargetUri('index/final.css')
    ->addFilter(new Phalcon\Assets\Filters\Cssmin());

In my view:

{{ assets.outputCss('header') }}

And the result:

<link rel="stylesheet" type="text/css" href="/index/final.css">

But when clicking in the generated link "/index.final.css", it says that:

Action 'final.css' was not found on handler 'index'

So my question is that how to set up a minify CSS or JS using asset built in featued of Phalcon?



30.4k
edited Aug '14

everything looks good in your code except:

->setTargetUri('index/final.css')

you have to correct that