Symfony 5 asset does not display the correct path

I didn’t find the answer there so I’m trying.

So basically I want to display my css from my path : /public/css/main.css

<link href="{{ asset('css/desktop-main.css') }}" rel="stylesheet">
<link href="{{ asset('build/app.css') }}" rel="stylesheet">

The issue is that when I dump these 2 the first one return :

“project_name/public/css/desktop-main.css”

but the second return :

“/build/app.css”

I was trying to learn webpack encore but even when I want to link the compiled file it’s not working.

Sorry if it’s obvious but I really can’t find it, thanks for your time !

Here’s the path :

project:
  assets:
  bin:
  config:
  node_modules:
  public:
      build:
          app.css
          app.js
      css:
          desktop-main.css

So it would be {{ asset('build/app.css') }} which should redirect me to : project/public/build/app.css but it’s still not redirecting, i’m still trying to use webpack encore but I also can’t link the entrypoints

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *