Nested ERB template templates such as Liquid?

With Liquid, you can expand layouts. For example, the default layout builds from the base layout .

Is this possible with ERB ? If so, how?

I ask because I port the GitHub site to Sinatra so that I can process forms natively (not from Wufoo or Google Forms ).

+3
source share
1 answer

try the following:

layout.haml( erb , ) . , ( haml):

 %html
  %head 
    %link(rel="stylesheet" type="text/css" href="style.css")  
  %body
    %div.outer
      %div.inner
        = yield

- =yield Sinatra , . = .

,

get '/' do 
  haml :index
end

/views/index.haml . , , /views/layout.haml.

, .

+2

Source: https://habr.com/ru/post/1783125/


All Articles