[nodejs] Node.Js 활용하기 - 섹션8. 정리정돈의 기술 1 - Jade Extends 살펴보기
jade extends
https://jade-lang.com/reference/extends
Extends | Jade Language
Template Inheritance The extends keyword allows a template to extend a layout or parent template. It can then override certain pre-defined blocks of content. doctype html html head block title title Default title body block content extends ./layout.jade bl
jade-lang.com
Template Engine인 Jade의 extends(상속)기능
jade 파일에서 중복을 방지하는 기능. 유지보수의 효율성 좋아지고, 중복되는 코드를 제거해서 코드량이 줄어든다. 가독성도 좋아짐.
html
head
body
ul
li JavaScript
li nodejs
li expressjs
article
block content
----------------------------------------
extends ./layout
block content
| JavaScript is...
layout.jade가 view.jade의 content block을 호출하는 것.
비슷한 기능으로 includes가 있음.
https://jade-lang.com/reference/includes
Includes | Jade Language
Includes allow you to insert the contents of one jade file into another. doctype html html include ./includes/head.jade body h1 My Site p Welcome to my super lame site. include ./includes/foot.jade head title My Site script(src='/javascripts/jquery.js') sc
jade-lang.com
비슷하지만 여기서는 includes를 실행하는 파일이 주인공.