使用 HAML 进行 Rails HTTP 流式传输
在 Rails 中对 HAML 项目使用 HTTP 流似乎存在问题。如果我使用 ERB 的话效果会很好。显然,我不是唯一一个这个问题。
它不适用于将 stream
放置在控制器顶部,或使用 render :stream =>; true
在操作中。
如何让 HAML 和 HTTP 流能够很好地协同工作?
更新:我在 gem 页面上提出了一个问题,此处。
There appears to be an issue with using HTTP streaming with HAML projects in rails. It works perfectly if I use ERB instead. Apparently, I'm not the only one with this problem.
It doesn't work with placing stream
at the top of the controller, or with using render :stream => true
in the action.
How can I get HAML and HTTP streaming to play nicely together?
Update: I've opened an issue on the gem's page, here.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
HAML 尚不支持此功能(来源):
This is not yet supported by HAML (source):
Haml 的内部结构是这样的,它确实在运行时写入缓冲区。然而,Rails 传统上为模板语言提供的“标准”API 是相当简单的进出调用。我不认为 Haml 目前有“流媒体支持”,但它更多的是一个 API 问题而不是其他任何问题。
我很好奇 Rails 如何插入 ERB 来做到这一点。
The internals of Haml are such that it is indeed writing out to a buffer as it goes along. However, the "standard" API that Rails has traditionally provided for templating languages is a fairly straightforward in-and-out call. I don't think Haml does currently have "streaming support", but its simply more of an API issue than anything else.
I'm curious as to how Rails is plugging into ERB to do this.