-
-
Notifications
You must be signed in to change notification settings - Fork 495
Use default_path instead of paths for Twig and Translator config #434
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request passes validation.
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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request passes validation.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
additional template paths
@@ -1,6 +1,8 @@ | |||
framework: | |||
default_locale: '%locale%' | |||
translator: | |||
# additional translations paths |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
additional translation paths
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request passes validation.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -1,7 +1,8 @@ | |||
framework: | |||
default_locale: '%locale%' | |||
translator: | |||
paths: | |||
- '%kernel.project_dir%/translations' | |||
# additional translation paths |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request passes validation.
Removed translations |
paths: ['%kernel.project_dir%/templates'] | ||
default_path: '%kernel.project_dir%/templates' | ||
# additional template paths | ||
#paths: [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going back to the simpleness version, anyway it's well documented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request passes validation.
Fix #416 (comment)