-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Profiler] HTML comments for twig blocks #32175
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
Comments
I tried something similar here #28056, but it has some edge cases for twig not being a HTML only template engine. I don't think we can anticipate it ... but feel to share your implementation :) |
My solution was to add a config to toggle the comments and config with an array of regex to blacklist some types of blocks. Example: |
And even in HTML templates, we could have blocks in places where adding a comment is not possible (I often have a block inside a |
This could be solved with a blacklist, which can be also extended |
I suggest that this feature is implemented outside of core first. |
@shyim the main problem is the weight put on upstream vendors. By default any template can be crashing, and the white/blacklist maintenance proliferates. |
@shyim even we like your idea, we think it's not "possible" to implement it in a generic way for the comments added above (not all templates are HTML, there are too many edge-cases where these comments shouldn't be added even when using HTML, etc.) So, let's try to implement this outside of Symfony in a third-party package and depending on the results, we can reconsider this decision. Meanwhile, let's close this until we have those results. Thanks for understanding! |
Description
When a project has huge amount of template files and a new developer has to change something in template, he will search long to find the location he wants to modify. I developed a new NodeVisitor which adds html comments for starting and ending a block. This helps to see directly in developer console, which file has to be modified.
Maybe it's a good addition to the profiler bundle, to toggle such html comments. What are you thinking?
Example

The text was updated successfully, but these errors were encountered: