Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are layouts in Node.js's Express Library?

I'm disabling this feature because I don't know what it is:

app.set('view options', { layout: false });

But It sounds interesting so I would like to know why was this designed, so I would like to know what are the usage cases and why is this good :)

like image 316
Adam Halasz Avatar asked Jun 23 '11 10:06

Adam Halasz


1 Answers

If you read the View Rendering section it tells you about layouts.

It's a way to apply generic HTML wrappers to all your pages.

For example Reference

!!! 5
html
  head
    title Blog
    link(rel='stylesheet', href=base + '/style.css')
  body
    #container!= body

Is a layout for an example from the express folder. This will be applied to all pages and your actual view that your rendering will be rendered in != body

like image 141
Raynos Avatar answered Oct 19 '22 23:10

Raynos