0

I am starting a Symfony 3 project.

My CSS files are in /web/css. The CSS files need to get fonts in a font folder at the same level than the CSS folder ( = /web/fonts)

I'm using assetic for CSS and JS files.

When I'm in prod, everything is OK. The CSS files looks in /MyApp/web/fonts/somefont.ttf and find the font.

But under app_dev.php, the file looks for /MyApp/web/app_dev.php/fonts/somefont.ttf which doesn't work.

How can I manage that ? Do I have to do something with assetic ?

Veve
  • 6,643
  • 5
  • 39
  • 58
Jeremie
  • 25
  • 1
  • 7

3 Answers3

0

You should use the twig function asset like explained in the best practices.

mykiwi
  • 1,671
  • 1
  • 19
  • 35
0

Since your web folder is the root path for Symfony on the web, folders within the web folder are relative to that folder. You probably should use asset like @romqin state, but you can also try something like this (in twig):

{% block stylesheets %}
     <link rel="stylesheet" href="/css/main.css"> 
{% endblock %}

Don't try to specify the absolute path, but just the relative path. This works for me both in DEV and PROD.

Alvin Bunk
  • 7,621
  • 3
  • 29
  • 45
0

Actually, I could solve my problem using this : Symfony2 - Assetic - css font icons

Thanks for helping !

Community
  • 1
  • 1
Jeremie
  • 25
  • 1
  • 7