Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Web Development with Jade

You're reading from   Web Development with Jade Knowing Jade makes life simpler and more productive for web developers, and this book will teach you the language concisely and thoroughly using lots of practical examples and best practices for a solid grounding.

Arrow left icon
Product type Paperback
Published in Mar 2014
Publisher
ISBN-13 9781783286355
Length 80 pages
Edition Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
Sean Lang Sean Lang
Author Profile Icon Sean Lang
Sean Lang
Arrow right icon
View More author details
Toc

Attributes


Attributes are also pretty important, so here's how to write those:

Jade

HTML

p(id="hello") Hello Word!
<p id="hello">Hello Word!</p>

That's right! They're pretty similar to the way you write attributes in HTML, except they're surrounded by a pair of parentheses. Also, if you have multiple attributes, they're delimited by commas, rather than just spaces. An example of this is as follows:

Jade

HTML

p(id="hello", class="world")
<p id="hello" class="world">
</p>

Tip

Jade 0.35.0 (released on August 21, 2013) added support for space-separated attributes. Soon, this will be supported by syntax highlighters, syntax checkers, and related tools like html2jade; but until then, you may wish to stick with the comma-delimited syntax. For this reason, the rest of this book will use comma-delimited attributes.

Passing objects as attributes

In Jade, you can easily pass strings as attributes, but if you pass objects, they will be turned into the most useful representation for...

You have been reading a chapter from
Web Development with Jade
Published in: Mar 2014
Publisher:
ISBN-13: 9781783286355
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime