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

@font-face url after minify css assets

Hi. As you can see in the code below

$cssCollection = $this->assets->collection('css_src');
        $cssCollection->setTargetPath('final.css');
        $cssCollection->setTargetUri('final.css');
        $cssCollection->addCss('https://fonts.googleapis.com/css?family=Open+Sans:400,600', false);
        $cssCollection->addCss('ilya-theme/backend/assets/bower_components/bootstrap/css/bootstrap.min.css');
        $cssCollection->addCss('ilya-theme/backend/assets/icon/icofont/css/icofont.css');
        $cssCollection->join(true);
        $cssCollection->addFilter(new Cssmin());

after making final.css , the font-face src does not refer to its orginal path and do not work on the site output the fonts.

final.css

@font-face {
    font-family: 'icofont';
    src: url('../fonts/icofont.eot?v=1.0.0-beta');
    src: url('../fonts/icofont.eot?v=1.0.0-beta#iefix')
Orginal path icofont.css and fonts

ilya-theme
                backend
                            assets
                                        icon
                                                icofont
                                                            css
                                                                    icofont.css
                                                            fonts
                                                                    icofont.eot

What is the problem with my code?



32.3k
Accepted
answer

The Cssmin filter is very simple, you have to use absolute paths or use other minificator like minify

Good luck