生成相当于一个树枝文件的HTML模板? [英] Generate the HTML template equivalent of a twig file?
问题描述
我想知道是否可以为每个 {filename} .html.twig生成
?我知道一种解决方案是从浏览器中复制和粘贴源代码,但是有没有更有效的方法? {filename} .html
预先感谢您。
我认为这样的解决方案可以满足您的需求。
curl www.yoururl.com> /path/to/yourfolder/file.html
看看下面的故事,感兴趣的话。
几个月前,我正在开发一个yii2项目。由于来自外部服务的响应,索引页面在3秒内加载。 Cloudflare和其他缓存方案没有成功 - 我想出了最好的2.5秒。
经过2-3天的思考,我发现了一个讨厌的解决方案:)
创建一个无缓存,新版本的主页并写了一个crone作业,获取该页面的内容并写入公共内部的index.html文件(在yii2 web $ c $每2分钟一次。
其他网页都可以 - (<0.2s),所以没有为他们写任何内容。
我所做的只是
卷曲www.example.com> ; /path/to/web/index.html
I'd like to know if it's possible to have {filename}.html
generated for every {filename}.html.twig
? 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 www.yoururl.com > /path/to/yourfolder/file.html
Have a look below story, if you interested in.
Story
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 www.example.com > /path/to/web/index.html
这篇关于生成相当于一个树枝文件的HTML模板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!