【问题标题】:How do I render a static haml template in padrino?如何在 padrino 中渲染静态 haml 模板?
【发布时间】:2015-04-17 08:39:23
【问题描述】:

我想做同样的事情:How do I automatically generate static HTML from HAML with Sinatra or Padrino?

这个答案对我来说还远远不够。设置好缓存后,如何将特定的 haml 文件发送到客户端?

例如

get '/foo', :cache => true do
    expires 30
    haml '/templates/foo.haml'
end

【问题讨论】:

    标签: ajax sinatra haml padrino


    【解决方案1】:

    如果您想在templates 中提供任何文件,您可以执行以下操作:

    get '/*', :cache => true do |name|
        expires 30
        haml "/templates/#{name}.haml"
    end
    

    它们都会被缓存。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-09-23
      • 1970-01-01
      • 2017-03-12
      • 2013-05-13
      • 1970-01-01
      • 2016-11-13
      • 2016-02-06
      相关资源
      最近更新 更多