Open tinnerdxp opened 6 years ago
Hello @tinnerdxp,
Thank you for your comment and I think also that some responses should be improved. But for your first example, I think that you are wrong according to the Symfony documentation:
This tag (spaceless) is not meant to "optimize" the size of the generated HTML content but merely to avoid extra whitespace between HTML tags to avoid browser rendering quirks under some circumstances.
If you want to optimize the size of the generated HTML content, gzip compress the output instead
For more information: https://twig.symfony.com/doc/2.x/filters/spaceless.html
Cheers
@jockhip12 — yeah, but how the Twig could compress output itself?
@jockhip12 — yeah, but how the Twig could compress output itself?
I didn't get your question, but you can find more details here : https://betterexplained.com/articles/how-to-optimize-your-site-with-gzip-compression/
I know how the gzipping output works. The matter is how do you trigger gzipping within Twig because this is what is everything about question.
Twig has no option on this because it's only templating engine, not a response handler.
The matter is how do you trigger gzipping within Twig
I got your point, and honestly I don't have an answer :/
I would like to add an answer that might be wrong in controller.yml. That's a small contribution, but hope it helps as well.
question: 'Which of these response objects does not exists?'
answers:
- {value: XmlResponse, correct: true}
- {value: FileResponse, correct: true}
- {value: TwigResponse, correct: true}
- {value: JsonResponse, correct: false}
- {value: BinaryFileResponse, correct: false}
- {value: RedirectResponse, correct: false}
- {value: StreamedResponse, correct: false}
help: |
'https://symfony.com/doc/current/components/http_foundation.html#response'
From the documentation of the v5.3, this JsonResponse exists : https://symfony.com/doc/current/components/http_foundation.html#creating-a-json-response
Hello,
I invite you to make a PR with your different proposals.
Have a good day :)
During the few weeks of usage I have noticed that some questions and answers could be improved. I obviously appreciate the effort of having this in general and would like to thank the authors for their efforts - it is a great help indeed.
I wonder whether we should just submit PRs for either grammar / typos / validity of some questions? I guess it's a massive topic to discuss so I would like to know your opinions first.
Example 1:
The correct answer (in my opinion) is "spaceless" even though the accepted answer is "gzip". Twig doesn't have any capabilities to gzip the output... it's down to the framework underneath or the web-server returning the response.
Example 2:
As per: https://symfony.com/doc/current/testing.html the answer should be probably ./vendor/bin/simple-phpunit but all the existing answers depend on how phpunit was installed as well as where the phpunit.xml file is located... (I think?)
Example 3: (from PHP pack though)
Even though ${0x0} is not considered a valid PHP variable - it actually works in all version of PHP from 4.x to 7.2 as long as one refers to it using the ${0x0} notation. so the correct answers should be ${0x0} and @$foo instead of @$foo and &$variable - which causes an error.
Example 4:
Accepted answers are: ETag, Last-Modified I'm not sure what the "validation cache model" is - but if it is a method of controlling browser caching - then Cache-Control and Expires should probably be there as well. If it means "methods of validating the cache" then Expires is a probable candidate. Again - I might be wrong on this - but it's very "tricky" question... Think 4 is enough to get your opinion on things. Cheers KP