Partial HAML templating in Ruby without Rails

后端 未结 5 705
Happy的楠姐
Happy的楠姐 2020-12-24 08:23

I really don’t need the overhead of Rails for my very small project, so I’m trying to achieve this just using just plain Ruby and HAML.

I want to include another HAM

5条回答
  •  执笔经年
    2020-12-24 08:57

    def render_file(filename)
      contents = File.read('views/'+filename)
      Haml::Engine.new(contents).render
    end
    

提交回复
热议问题