Options Symfony Asset

In Symfony 2 Im, using resource binding, for example.

{% stylesheets 'bootstrap/css/bootstrap.css' 'bootstrap/flat/css/flat-ui.css' filter='cssrewrite' filter='?yui_css' %} 

It works fine, however my @ font-face resources are not loading. They work fine in the dev environment, but as soon as css is inserted into a single file in the production environment, does the default font load instead?

cssrewrite works correctly, since I checked that the relative path was updated correctly to point to the right area, I even tried to use an absolute URL that did not work.

I tried to compile, which did not help. The only thing that worked was to remove it from the kit and download it directly.

Is there some kind of bug with combining symfony assets and @ font-face: S: S: S

Below is the css for @ font-face in the prod environment after it was bundled.

 @font-face{font-family:"Flat-UI-Icons-16";src:url("../bootstrap/flat/fonts/Flat-UI-Icons-16.eot");src:url("../bootstrap/flat/fonts/Flat-UI-Icons-16.eot?#iefix") 
+4
source share
1 answer

This Stackoverflow page has some good info on URLs in CSS files.

One answer says that relative URLs in a CSS file refer to the directory in which the file is located.

If your font is loaded from

 bootstrap/css/bootstrap.css 

And the URLs in CSS look like the following relative url:

 ../bootstrap/flat/fonts/Flat-UI-Icons-16.eot 

This means that the browser will try to get the font as follows

 bootstrap/bootstrap/flat/fonts/Flat-UI-Icons-16.eot 

You probably want to try the following URL style

 ../../bootstrap/flat/fonts/Flat-UI-Icons-16.eot 

or

 ../flat/fonts/Flat-UI-Icons-16.eot 

I would highly recommend the css path fix documentation with the cssrewrite filter .

Note that if you use the cssrewrite filter, you cannot use the @YourAwesomeBundle syntax.

I hope this fixes your problem.

0
source

All Articles