jade 문법 정리

jade 문법 정리

Jade 문법에 대하여 알아봅시다.


jade에 관한 자세한 문법은 Jade Language Reference를 참고하세요.

조건문(conditionals)

- var user = { description: 'foo bar baz' }
- var authorised = false
#user
	if user.description
		h2 Description
		p.description= user.description
	else if authorised
		h2 Description
		p.description.
			User has no description,
			why not add one...
	else
		h1 Description
		p.description User has no description

결과

1
2
3
4
<div id="user">
	<h2>Description</h2>
	<p class="description">foo bar baz</p>
</div>


부정문

unless user.isAnonymous
	You're logged in as #{user.name}
if !user.isAnonymous
	p You're logged in as #{user.name}

comments powered by Disqus