Book Image

Web Development with Jade

By : Sean Lang
Book Image

Web Development with Jade

By: Sean Lang

Overview of this book

Table of Contents (16 chapters)

General best practices

Most of the good practices that are used when writing HTML carry over to Jade. Some of these include the following:

  • Using a consistent naming convention for ID's, class names, and (in this case) mixin names and variables

  • Adding alt text to images

  • Choosing appropriate tags to describe content and page structure

The list goes on, but these are all things you should already be familiar with. So now we're going to discuss some practices that are more Jade-specific.

Keeping logic out of templates

When working with a templating language, like Jade, that allows you to use advanced logical operations, separation of concerns (SoC) becomes an important practice. In this context, SoC is the separation of business and presentational logic, allowing each part to be developed and updated independently.

An easy point to draw the border between business and presentation is where data is passed to the template. Business logic is kept in the main code of your application and passes the data...