clubmed
clubmed

Reputation: 1

Wrong path for css/js on symfony route with argument

I'm using symfony 4.4. I have a controller who have differents routes...

One of them have a token on arguments like this :

/**
 * @Route("/activation/{token}", name="activation")
 */
public function activation(...

For this route and only this one, my css dosn't load because the path is wrong:

GET http://127.0.0.1:8000/activation/css/style.css net::ERR_ABORTED 404 (Not Found)

When i remove then{token} argument from my route my css loaded.

For my template i declare css like this on my base.html.twig:

<link rel="stylesheet" type="text/css"  href="{{ asset('css/style.css')}}" />#}

Anyone have any idea why asset function render dynamique path ?

Upvotes: 0

Views: 396

Answers (1)

Tom
Tom

Reputation: 1223

You can add Requirement for your route with a regular expression which will exclude css name from token argument.

Upvotes: -1

Related Questions