Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
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

Preface

Jade is a templating engine for Node.js. It is a new, simplified language that compiles into HTML and is extremely useful for web developers. Jade is designed primarily for server-side templating in Node.js, but it can also be used in a variety of other environments to produce XML-like documents, such as HTML and RSS. This book is an introduction to Jade, and it will provide readers a with faster and cleaner way to write HTML that is more maintainable and automates redundant markup.

What this book covers

Chapter 1, What is Jade?, gives you the idea behind preprocessors and why Jade is awesome. Also, you will learn the process Jade uses to compile templates, and how to install/use Jade.

Chapter 2, Basic Syntax, covers the very basics of the syntax. This includes how indentation-based syntaxes work, how to write tags, text, attributes, comments, and some nifty shorthands for classes, IDs, and doctypes.

Chapter 3, Feeding Data into Templates, covers both the syntax used to output variables (such as interpolation) and how to actually send the data to the renderer.

Chapter 4, Logic in Templates, introduces flow control structures such as if, else, case, for, and while. Also, we discuss adding more advanced logic using raw JavaScript.

Chapter 5, Filters, introduces you the first "feature" of the Jade language—filters—a way to automatically compile other preprocessed languages (such as Stylus, Markdown, or CoffeeScript) directly in templates.

Chapter 6, Mixins, offers a way to write reusable functions inside templates in order to reduce redundancy.

Chapter 7, Template Inheritance, helps you learn about the last major part of the language, template inheritance, which is done through a block system. In addition, you learn about the include keyword, which lets us include non-Jade files such as scripts and styles.

Chapter 8, Organizing Jade Projects, shows us some of the best practices to follow while organizing Jade projects. Also, we look at the use of third-party tools to automate tasks.

Appendix, A Closing Note – Contributing Back to Jade, gives an introduction to the Jade community.

What you need for this book

  • Some type of computer that is able to run Node.js

  • A text editor that you don't hate, such as Sublime Text, vim, emacs, or nano

  • The patience and determination required to learn

Who this book is for

This book is for web developers with at least a basic understanding of HTML and JavaScript.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "By default, jade compiles and renders the file, but if we only want it to compile into JS, we can use the --client argument."

A block of code is set as follows:

doctype html
html
  head
  body
    h1 Meet Jade
    p.
      A simple Jade example.
      You'll learn to write
      all of this in ch 2.
    p Jade FTW!

Any command-line input or output is written as follows:

$ npm install jade -g

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.

lock icon The rest of the chapter is locked
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 €18.99/month. Cancel anytime