Samir Chahine Samir Chahine - 2 months ago 11
Twig Question

Generate the HTML template equivalent of a twig file?

I'd like to know if it's possible to have

generated for every
? I know one solution is to copy and paste the source code from the browser, but is there a more efficient way of doing this?

Thank you in advance.


Such solution, I think, will satisfy your needs.

curl > /path/to/yourfolder/file.html

Have a look below story, if you interested in.


A few months ago, i was working on a yii2 project. The index page was loading in 3 seconds because of response from external services. Cloudflare and other caching scenarios weren't succeeded - I came up with 2.5 seconds best.

After 2-3 days of thinking period, I found a nasty solution :) Created a cache-less, fresh version of homepage and wrote a crone job, to fetch the contents of that page and write into index.html file inside public (in yii2 web) folder in every 2 minutes.

Other pages were ok - (<0.2s), so didn't wrote anything for them.

All I've done, was

curl > /path/to/web/index.html