Answer the question
In order to leave comments, you need to log in
What is extends in Pug (Jade)?
Good afternoon dear experts.
Faced with not understanding what extends
Pug (former Jade) is in the html preprocessor
Could you explain to me what it is for and where is the best way to use it? Thanks a lot for any clarification!
PS include
I figured it out completely, but I extends
still don’t understand the essence
Answer the question
In order to leave comments, you need to log in
described normally in https://pugjs.org/language/extends.html
extends describes a template (ancestor or layout) and the output will be wrapped in this base template, while the current template can replace any blocks in the ancestor template.
Template inheritance can be any depth.
It's usually useful to create a template for different elements and refine it for some types of them.
Well, for the introduction of layouts (layouts).
Just think of it as inheritance, where the child can override the ancestor's blocks.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question