0
votes

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 ?

1
do you have a base uri/path set in your html? also, can you please check what is exactly in the output html? (view source in browser)Jakumi
Try changing your CSS style path to /css/style.css or /css/activation.css, because the current path is conflicting with your controller route.Leprechaun
@Leprechaun according to docs, without the leading slash is the correct way. I assume there's some base path/uri stuff going on that moves this to another base path, since it also only happens on this page ...Jakumi
@Jakumi In template everything is correct, I think you need to check Asset configLeprechaun

1 Answers

0
votes

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