Use default_path instead of paths for Twig and Translator config#434
Use default_path instead of paths for Twig and Translator config#4343 commits merged intosymfony:masterfrom
Conversation
|
Is this really a good idea? Showing the |
|
I agree with Christian. I've changed the |
|
For new projects it might not be that common, as templates should still be stored under |
|
I would really be surprised if many people were overriding the paths. I cannot even think of one good reason to do that. But I understand the point. But:
|
|
Redefining the default path again in |
|
Registering the existing default path in |
|
@stof That means you agree with this change, right? Could I get the last approval then? |
|
Related to this, someone asked about this yesterday on Slack:
They replied him: twig:
paths: ['%kernel.project_dir%/templates/plymouth', '%kernel.project_dir%/templates']And he said:
Apart from this, I understand what you say about
|
|
if changing this configuration is really frequent and useful then it has won the place to appear by default. How does this look now? |
| @@ -1,4 +1,6 @@ | |||
| twig: | |||
| # additional templates paths | |||
| framework: | ||
| default_locale: '%locale%' | ||
| translator: | ||
| # additional translations paths |
|
symfony/symfony#27764 (comment) it's another reason to make this change. Setting the default path in Twig |
| - '%kernel.project_dir%/translations' | ||
| # additional translation paths | ||
| #paths: [] | ||
| default_path: '%kernel.project_dir%/translations' |
There was a problem hiding this comment.
Are you sure default_path works here ? IIRC, it is a Symfony 3.4+ feature, while this recipe applies to 3.3+
There was a problem hiding this comment.
Yes, but I'm following the same approach that @nicolas-grekas in the previous PR:
#416 (comment) (3.3 is EOLed so we don't really care for it)
There was a problem hiding this comment.
a recipe is for new projects 99%, and no new project will use this recipe ever (or at least we don't care IMHO)
There was a problem hiding this comment.
but then, it would be better to migrate this recipe to be 3.4+ and have no recipe at all for 3.3, than to have a 3.3+ recipe triggering an error on 3.3
| translator: | ||
| paths: | ||
| - '%kernel.project_dir%/translations' | ||
| # additional translation paths |
There was a problem hiding this comment.
maybe we should remove this one? I'm not sure it's that common to add more paths, so better keep the config simpler? (same below of course)
There was a problem hiding this comment.
I think so too, but there is no consensus about that (others member think otherwise) at least for Twig paths. See previous comments.
|
I still think that we should display |
46afbf6 to
cc439b6
Compare
|
Removed translations |
| paths: ['%kernel.project_dir%/templates'] | ||
| default_path: '%kernel.project_dir%/templates' | ||
| # additional template paths | ||
| #paths: [] |
There was a problem hiding this comment.
@javiereguiluz can you hint when this is needed? Still feels like something we could clean :)
Any other opinion from anyone else?
There was a problem hiding this comment.
In real apps I've used it 1) to add another directory where templates were defined (yes, I know, this is the obvious purpose!), 2) on symfony.com app I use it to define Twig namespaces, 3) in some personal apps I use it to add public/static/images/ as a directory for templates. Why? Because that way I can use the SVG icons as regular images in SCSS and embed them in Twig templates with {{ source('icons/-------.svg') }}
But again, if most people never change this option, let's remove it from the default config file. Thanks!
There was a problem hiding this comment.
Going back to the simpleness version, anyway it's well documented.
Fix #416 (comment)