Web Development with Jade

Web Development with Jade
eBook: $14.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 15%!
Print + free eBook + free PacktLib access to the book: $39.98    Print cover: $24.99
save 6%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters
  • Make your templates clean, beautiful, and reusable
  • Use Jade best practices right from the start
  • Successfully automate redundant markup

Book Details

Language : English
Paperback : 80 pages [ 235mm x 191mm ]
Release Date : March 2014
ISBN : 1783286350
ISBN 13 : 9781783286355
Author(s) : Sean Lang
Topics and Technologies : All Books, Web Development, Open Source

Table of Contents

Chapter 1: What is Jade?
Chapter 2: Basic Syntax
Chapter 3: Feeding Data into Templates
Chapter 4: Logic in Templates
Chapter 5: Filters
Chapter 6: Mixins
Chapter 7: Template Inheritance
Chapter 8: Organizing Jade Projects
Appendix: A Closing Note – Contributing Back to Jade
  • Chapter 1: What is Jade?
    • Markup like poetry
      • Why should I preprocess?
      • How Jade preprocesses
      • Comparison with other preprocessors
        • HAML
        • PHP
        • Jinja2
        • Mustache
      • Installation instructions
    • Compiling Jade
    • Summary
  • Chapter 2: Basic Syntax
    • Significance of whitespace
    • Tags
      • Text and blocks of text
        • Text on the same line
        • Text blocks
        • Shorthand text blocks
    • Inline HTML
    • Attributes
      • Passing objects as attributes
    • Shorthands
      • IDs and classes
      • Automatic div
    • Comments
      • Single line
      • Block comments
    • Block expansion
    • Doctypes
    • Summary
  • Chapter 3: Feeding Data into Templates
    • Syntax
    • Defining variables
    • Interpolation everywhere!
    • Using variables without interpolation
    • Escaping
    • Sending the variables to the compiler
      • Compiler arg
      • Programmatically
    • Summary
  • Chapter 4: Logic in Templates
    • Adding logic with JavaScript
      • If/else
      • For loops
      • Complex operations
    • Built-in logical operators
      • If / else / else if
      • Unless
      • Cases
      • Each loops
      • While loops
    • A warning about interpolation
    • Summary
  • Chapter 5: Filters
    • The full list
      • Template engines
      • Stylesheet languages
      • Minifiers
      • Others
    • Examples
      • Markdown
      • CoffeeScript
      • Stylus
    • Passing arguments
    • Summary
  • Chapter 6: Mixins
    • Syntax and mechanics
      • Defining mixins
      • Calling mixins
      • Passing blocks
    • Another warning about interpolation
    • The arguments object
    • Summary
  • Chapter 7: Template Inheritance
    • Blocks
      • Blocks don't provide encapsulation
    • Extends
      • Replace
      • Append
      • Prepend
      • Incompatibility
      • Extra things in extenders
    • Includes
      • Static
      • Filtered
      • Jade
    • Summary
  • Chapter 8: Organizing Jade Projects
    • General best practices
      • Keeping logic out of templates
      • Inlining
      • Minification
      • Removing style-induced redundancy
      • Semantic divisions
      • Server-side versus client-side rendering
        • Client-side rendering
        • Server-side rendering
      • Build systems
    • Summary

Sean Lang

Sean Lang attends the Milwaukee School of Engineering; he is currently majoring in software engineering. Even though he is a freshman there, he is by no means new to the field. He has been teaching himself software development for the last four years, and during this time, he has done extensive volunteer work for open source software projects. These include roots (a toolkit for building web apps), the Jade template engine, nib (a set of utilities for advanced web page styling), and a myriad of smaller projects. In addition to this, he has been doing freelance web designing and consulting, which is especially convenient because it gives him an opportunity to use the open source tools that he has been developing in production. He started writing this book about Jade to supplement the existing documentation and help teach people the language. Also, he had never written a full book before, so he was really interested and excited to know what being an author is like.

Code Downloads

Download the code and support files for this book.

Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.

Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

Web Development with Jade +    Clojure for Machine Learning =
50% Off
the second eBook
Price for both: $33.00

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • Write cleaner, indentation-based markup
  • Use logical statements to format data for display on the Web
  • Avoid repetition by eliminating redundant operations
  • Divide your templates into logical sections with blocks
  • Avoid common organizational pitfalls when designing Jade-based projects
  • Apply shorthand for brevity
  • Utilize Jade for client-side templates
  • Employ techniques like filters to quickly mock-up web pages in higher level languages like stylus or coffeescript

In Detail

Jade is a template engine for node.js and the default rendering engine for the Express web framework. 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 practical, example-oriented guide will teach you how to write Jade, utilize its features, and recognize the best ways to organize templates in your projects. With this book, you will avoid the common pitfalls and issues with sparse documentation, allowing you to learn Jade faster and use it more effectively.

To understand Jade, we will first examine the reasons for its design and how these translate into a tool that can provide real benefits to you. You will develop confidence with each of the features of the language with the help of practical examples and thorough explanations. We will cover preprocessors, basic syntax, feeding data into templates, and incorporating logic. By the end of this book, you will be able to effectively use essential features such as filters and mixins as well as template inheritance through a block system. To tie it all together, we will also look at some of the best practices to follow when organizing your Jade projects.

Use this comprehensive guide to the Jade language to help you become a more efficient web developer.


This is a step-by step, tutorial-based book which will enable web developers to explore the functionalities of Jade and learn how to use it to write certain functions and processes for web development.

Who this book is for

This book is for web developers with at least a basic understanding of HTML and JavaScript. It will enable you to write an easier form of language that then compiles into HTML.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software