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.

Web Development with Jade

Starting
Sean Lang

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.
$14.99
$24.99
RRP $14.99
RRP $24.99
eBook
Print + eBook
$12.99 p/month

Want this title & more? Subscribe to PacktLib

Enjoy full and instant access to over 2000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.
+ Collection
Free Sample

Book Details

ISBN 139781783286355
Paperback80 pages

About This Book

  • Make your templates clean, beautiful, and reusable
  • Use Jade best practices right from the start
  • Successfully automate redundant markup

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.

Table of Contents

Chapter 1: What is Jade?
Markup like poetry
Compiling Jade
Summary
Chapter 2: Basic Syntax
Significance of whitespace
Tags
Inline HTML
Attributes
Shorthands
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
Summary
Chapter 4: Logic in Templates
Adding logic with JavaScript
Built-in logical operators
A warning about interpolation
Summary
Chapter 5: Filters
The full list
Examples
Passing arguments
Summary
Chapter 6: Mixins
Syntax and mechanics
Another warning about interpolation
The arguments object
Summary
Chapter 7: Template Inheritance
Blocks
Extends
Includes
Summary
Chapter 8: Organizing Jade Projects
General best practices
Summary

What You Will Learn

  • 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.

Authors

Table of Contents

Chapter 1: What is Jade?
Markup like poetry
Compiling Jade
Summary
Chapter 2: Basic Syntax
Significance of whitespace
Tags
Inline HTML
Attributes
Shorthands
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
Summary
Chapter 4: Logic in Templates
Adding logic with JavaScript
Built-in logical operators
A warning about interpolation
Summary
Chapter 5: Filters
The full list
Examples
Passing arguments
Summary
Chapter 6: Mixins
Syntax and mechanics
Another warning about interpolation
The arguments object
Summary
Chapter 7: Template Inheritance
Blocks
Extends
Includes
Summary
Chapter 8: Organizing Jade Projects
General best practices
Summary

Book Details

ISBN 139781783286355
Paperback80 pages
Read More