Rendering HAML partials from within HAML outside of Rails

前端 未结 5 616
后悔当初
后悔当初 2020-12-31 16:54

I\'m using HAML to generate some static html pages for a site, and I was wanting to split out common components into partials that I can include in multiple pages, just like

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-31 17:33

    I finally found what I was looking for, so I thought I'd share my find with you. you can simply use the same syntax you use for haml in the first place - http://www.semicomplete.com/blog/geekery/partials-in-haml-in-sinatra.html

    /views/file.haml

    %h3 Title
    %div= haml :content, :layout => false
    

    /views/content.haml

    %p your content here
    

提交回复
热议问题