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.

@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?



27.4k
Accepted
answer

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

Good luck