Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between "extends" and "include" in Jade?

Tags:

include

pug

With both of these commands I can use code from another file. As I see it when we use extends file.jade we can use block, to change blocks in file.jade before the compilation. But is it the only difference and am I right? Thank you.

like image 773
Georgy Avatar asked Jun 03 '15 19:06

Georgy


1 Answers

Well, as @laggingreflex wrote above, there are docs on these commands: extends and include.

Extra points: you can use include for different files, not only for jade files. Also, you can use include multiple times on the page. This command just includes content of the different file, straight into the place. You may think of it, as if you make a big Lego project by using (including) different small pieces.

Extends on the contrary takes big Lego project and substitutes marked blocks with your pieces with special block command. It could be used once and overwrite content of the destination file (file with the extends command).

like image 119
Georgy Avatar answered Sep 27 '22 19:09

Georgy