Closed wtty closed 6 years ago
This syntax worked fro Symfony 3, not tested in real case with Symfony 4. You can try the complete. Here are the short-cuts supposed to be implemented: https://github.com/pug-php/pug-symfony/blob/master/src/Jade/JadeSymfonyEngine.php#L138
So you can try a(href=view.router.path('some_route'))
Those would be great, being able to use translations in pug would be nice too {{ title('page_title'|trans) }}
I tried what you suggested, but it didn't work:
Use of undefined constant view - assumed 'view'
The asset function doesn't seem to work either:
link(rel="stylesheet" href=asset('/build/style.css'))
Error:
Undefined index: assets
Oh, I guess, you set expressionLanguage to php, so you can't use JS-style:
a(href=$view['router']->path('some_route'))
The trans filter just call the symfony translator under the hood, you can pass the translator instance as a local or shared variables to views then just call the method.
I also tried that, but get the following:
Use of undefined constant router - assumed 'router'
Oh ok, I will keep that in mind.
I installed pug-symfony in Symfony 4 with no issues but routes are not working for me:
The following route works in twig:
In pug:
It throws this error: Function name must be a string