Web Development with Jade

Web Development with Jade

Language: English

Pages: 67

ISBN: 1783286350

Format: PDF / Kindle (mobi) / ePub


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.

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.

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.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

of the different parts of a page. A common example of this would be dividing a page between the header, footer, sidebar, and main content. These could be combined into one monolithic file, but putting each in a separate block represents their separation, can make the project easier to navigate, and allows each to be extended individually. Server-side versus client-side rendering Since Jade can be used on both the client-side and server-side, we can choose to do the rendering of the templates

recompilation helps you notice errors sooner and Roots helps you avoid the hassle of manually running a command to recompile. Summary In this chapter, we just finished taking a look at some of the best practices to follow when organizing Jade projects. Also, we looked at the use of third-party tools to automate tasks. [ 59 ] A Closing Note – Contributing Back to Jade Jade is made possible by a wonderful group of volunteers who are passionate about making web development easier. The language

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. About the Reviewers Fco. Javier Velasco Arjona is a passionate full stack engineer and aspiring web craftsman from Córdoba,

href="javascript:"> It even works in text blocks: - i = ['proident', 'dreamcatcher', 'ennui', 'Tonx']

proident dreamcatcher ennui Tonx

pre | #{i[0]} #{i[1]} | #{i[2]} #{i[3]} It even works in tag names: - mytag = "section" #{mytag} Got some content in here

Got some content in here

Storing your tag names in variables is usually a bad idea because it isn't very natural or expected to be read that way. You may find some use cases, but avoid it. [

#{book} - books = {"000":"A", "001":"B", "010":"C"} select each book, i in books option(value=i) Book #{book}

  • one
  • two
  • three

You can also use for in place of each—they mean the same thing. [ 32 ]

Download sample

Download