Comments (7)
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.
from symfony-pack.
Hello,
I invite you to make a PR with your different proposals.
Have a good day :)
from symfony-pack.
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
from symfony-pack.
@jockhip12 — yeah, but how the Twig could compress output itself?
from symfony-pack.
@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/
from symfony-pack.
The matter is how do you trigger gzipping within Twig
I got your point, and honestly I don't have an answer :/
from symfony-pack.
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
from symfony-pack.
Related Issues (13)
- How to add more questions? HOT 4
- Symfony 3 Certification Questions HOT 2
- Errors during yaml files parsing
- Backslashes in right answer are not properly formatted HOT 4
- Twig path() question HOT 5
- Document all PSRs HOT 2
- Make the certification pack valid for both Symfony 2 and Symfony 3 and Symfony 4 HOT 8
- Answer on a question not so clear HOT 2
- Doubt about an answer marked as right HOT 7
- EventDispatcher implements not only the Meditor but also the Observer design pattern
- HTTP: Safe HTTP methods HOT 1
- New release
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from symfony-pack.