What is “enable template” in Express / Jade?

This article seems to suggest that there are such things as include templates. I did obvious Google searches but did not find any documentation.

What are they?

+4
source share
2 answers

From the Express Guide :

The Express viewer has built-in support for partial and collections, which are “mini” views representing a portion of a document. For example, instead of repeating the view to display comments, we can use a partial collection.

So, when you have the same "view" for the user on several pages, it is more useful to have this view stored in a file and to include it everywhere. (DRY - don't repeat yourself)

Another example is that the world has the same layout and you want to include the rest of the page (for example, you can include different headers, footers and footers depending on the page).

Here is a good example with Jade presented in Express examples:

https://github.com/visionmedia/express/tree/master/examples/jade/views

+8
source

https://github.com/visionmedia/jade

It is in one of the H2 headings.

+2
source

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


All Articles