-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[TwigBundle] Allow to exclude files and directories on cache warmup #34416
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
Note that I'm using |
I'm always very skeptical when we add new settings and when they are global. The |
But what's with things like this?
In a bare Symfony 4 installation with only twig installed I already get 28 templates and 64 'other' files including php templates and images. Details: list of loaded templates during cache warmup"base.html.twig"
"@Framework/FormTable/hidden_row.html.php"
"@Framework/FormTable/button_row.html.php"
"@Framework/FormTable/form_widget_compound.html.php"
"@Framework/FormTable/form_row.html.php"
"@Framework/Form/form_rows.html.php"
"@Framework/Form/color_widget.html.php"
"@Framework/Form/integer_widget.html.php"
"@Framework/Form/form_widget_simple.html.php"
"@Framework/Form/button_widget.html.php"
"@Framework/Form/repeated_row.html.php"
"@Framework/Form/button_attributes.html.php"
"@Framework/Form/hidden_widget.html.php"
"@Framework/Form/money_widget.html.php"
"@Framework/Form/form_start.html.php"
"@Framework/Form/datetime_widget.html.php"
"@Framework/Form/form_rest.html.php"
"@Framework/Form/reset_widget.html.php"
"@Framework/Form/form_errors.html.php"
"@Framework/Form/form_enctype.html.php"
"@Framework/Form/form.html.php"
"@Framework/Form/form_end.html.php"
"@Framework/Form/widget_container_attributes.html.php"
"@Framework/Form/search_widget.html.php"
"@Framework/Form/widget_attributes.html.php"
"@Framework/Form/choice_attributes.html.php"
"@Framework/Form/hidden_row.html.php"
"@Framework/Form/email_widget.html.php"
"@Framework/Form/choice_widget_options.html.php"
"@Framework/Form/checkbox_widget.html.php"
"@Framework/Form/choice_widget.html.php"
"@Framework/Form/range_widget.html.php"
"@Framework/Form/attributes.html.php"
"@Framework/Form/url_widget.html.php"
"@Framework/Form/button_row.html.php"
"@Framework/Form/form_widget.html.php"
"@Framework/Form/textarea_widget.html.php"
"@Framework/Form/radio_widget.html.php"
"@Framework/Form/tel_widget.html.php"
"@Framework/Form/choice_options.html.php"
"@Framework/Form/collection_widget.html.php"
"@Framework/Form/form_help.html.php"
"@Framework/Form/choice_widget_expanded.html.php"
"@Framework/Form/button_label.html.php"
"@Framework/Form/submit_widget.html.php"
"@Framework/Form/date_widget.html.php"
"@Framework/Form/number_widget.html.php"
"@Framework/Form/form_label.html.php"
"@Framework/Form/percent_widget.html.php"
"@Framework/Form/container_attributes.html.php"
"@Framework/Form/choice_widget_collapsed.html.php"
"@Framework/Form/time_widget.html.php"
"@Framework/Form/form_widget_compound.html.php"
"@Framework/Form/form_row.html.php"
"@Framework/Form/password_widget.html.php"
"@Twig/base_js.html.twig"
"@Twig/Exception/exception_full.html.twig"
"@Twig/Exception/exception.css.twig"
"@Twig/Exception/error.html.twig"
"@Twig/Exception/traces_text.html.twig"
"@Twig/Exception/error.js.twig"
"@Twig/Exception/error.txt.twig"
"@Twig/Exception/exception.html.twig"
"@Twig/Exception/trace.txt.twig"
"@Twig/Exception/traces.html.twig"
"@Twig/Exception/exception.json.twig"
"@Twig/Exception/trace.html.twig"
"@Twig/Exception/exception.atom.twig"
"@Twig/Exception/traces.txt.twig"
"@Twig/Exception/exception.rdf.twig"
"@Twig/Exception/exception.js.twig"
"@Twig/Exception/exception.txt.twig"
"@Twig/Exception/error.css.twig"
"@Twig/Exception/exception.xml.twig"
"@Twig/Exception/error.atom.twig"
"@Twig/Exception/traces.xml.twig"
"@Twig/Exception/error.json.twig"
"@Twig/Exception/logs.html.twig"
"@Twig/Exception/error.rdf.twig"
"@Twig/Exception/error.xml.twig"
"@Twig/exception.css.twig"
"@Twig/layout.html.twig"
"@Twig/images/icon-minus-square.svg"
"@Twig/images/favicon.png.base64"
"@Twig/images/icon-plus-square.svg"
"@Twig/images/symfony-ghost.svg"
"@Twig/images/icon-book.svg"
"@Twig/images/chevron-right.svg"
"@Twig/images/icon-plus-square-o.svg"
"@Twig/images/icon-minus-square-o.svg"
"@Twig/images/icon-support.svg"
"@Twig/images/symfony-logo.svg" In this case filtering for |
Fair enough 👍 |
@m-vo in this case, this file is a template ( |
You mean a template without any placeholders? That's an asset imho and that should not need to be parsed. |
So you can put any file/directory (not related to Twig's templates) in
templates/
dir and configure which files/directories can or cannot be warmed up, increasing the performance on 'cache:clear' (sometimes impossible).Example of configurations:
Backward Compatibility
Unaffected! By default all files for all Twig's paths will be warmed up as well as the
'bundles'
directory will be excluded even if it's not added to thecache_exclude_paths
option by the user.It's up to you to decide the structure of your template directories and which files/dirs should or shouldn't be cached.
Replacement of #34321
Also related to #28282
wdyt?