19,19 €
Handlebars is one of the leading JavaScript templating engines and is quickly gaining widespread adoption by developers, as well as with frameworks like Ember.js and Meteor.
"Instant Handlebars.js" is a complete guide to the Handlebars library filled with internal concepts and practical examples that will help illustrate what's going on and take you from a complete beginner to a Handlebars expert.
"Instant Handlebars.js" begins with the very basics, requiring no previous knowledge about templating engines. Throughout the course of this book, you get a thorough tour of all the features available in Handlebars.js and you will learn how to organize your websites for both development and production.
In this book, we will cover how to create templates with both placeholders and helpers. We will then go into organizing your projects for rapid -development using Require.js and how to optimize and compile your projects for production. To finish off, you will learn how to annotate your code and leave debug points so that you can easily maintain and troubleshoot your code in the future.
Handlebars is a small library;, it is meant to fill a specific need and it does this well. "Instant Handlebars.js" takes a very methodical approach to cover every aspect of this amazing library with practical examples provided every step of the way.
Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:
Seitenzahl: 69
Veröffentlichungsjahr: 2013
Copyright © 2013 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: September 2013
Production Reference: 1240913
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78328-265-4
www.packtpub.com
Author
Gabriel Manricks
Reviewers
Jonathan Christopher
Nuno Oliveira
Acquisition Editor
Rubal Kaur
Commissioning Editor
Llewellyn Rozario
Technical Editor
Dipika Gaonkar
Project Coordinator
Sageer Parkar
Proofreader
Julie Blake
Production Coordinator
Aparna Bhagat
Cover Work
Aparna Bhagat
Cover Image
Sheetal Aute
Gabriel Manricks is a full stack software & web developer focusing on PHP and both frontend and server-side JavaScript frameworks.
Gabriel works as a staff writer for NetTuts+, where he enjoys learning as well as teaching others, and he also freelances in web consulting, development, and writing.
Jonathan Christopher is a developer living in upstate New York with his wife Carrie and their son Micah. He focuses on both frontend and server-side development for his company Iron to Iron (http://irontoiron.com). He writes for Monday By Noon (http://mondaybynoon.com) and has also authored Client Oriented WordPress Development (https://clientwp.com).
Nuno Oliveira is a software engineer with over 10 years of professional experience. A windows developer for many years, he has an extensive background in the full life cycle of the software development process. He now concentrates on web development, working with ASP.net, PHP, HTML, CSS, and JavaScript. He currently lives in London, United Kingdom. You can always find him on twitter at @nm_oliveira.
You might want to visit www.PacktPub.com for support files and downloads related to your book.
Did you know that Packt offers e-Book versions of every book published, with PDF and e-Pub files available? You can upgrade to the e-Book version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the e-Book copy. Get in touch with us at <[email protected]> for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and e-Books.
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read, and search across Packt's entire library of books.
If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access.
Welcome to the Instant Handlebars.js, in this book we will be taking a thorough look through this amazing templating library, as well as ways to manage your projects and optimize them for production.
This book contains the following sections:
So, what is Handlebars? here we will take a look at what a templating engine really is and more specifically why we are learning Handlebars.
Installation we will go through downloading the Handlebars library as-well as installing node.js and the handlebars CLI.
Quick start – creating your first template will get our feet wet, starting off by writing the minimum amount of code required to get a template onto the page, moving on to creating a simple helper.
Top 6 Features you need to know about will take a deep look at all the features Handlebars has to offer, as well as tips on organizing large projects and pre-compiling templates. Topics include:
People and places you should get to know will take a look at different people and places you should subscribe to, to stay up-to-date, and learn more.
To answer this properly, we need to first understand what a templating engine is, or better, what it comes to accomplish. Any dynamic site (blog, store, and so on) has parts which remain static, and at least rules on how the dynamic data should be inserted. A templating engine can and should be thought of as a new language in its own right and has a specialized syntax made specifically for rendering views.
Before templating engines you would have some kind of code in your actual DOM pages, through which you would insert the dynamic pieces of data at specific points. This is not great code separation, and it's definitely not a very clean option. A templating engine is meant to augment this step with its specialized syntax made specifically for this purpose; if done right, you should end up with clean and reusable templates, and leave your app clear of any bodge code.
Mustache was a pretty popular templating library for years and has basically been ported to nearly every programming language available. The problem with Mustache is that it is fairly opinionated on how you should write your templates; it follows a strict "View-Controller" separation and is a purely logic-less engine made specifically for replacing expressions with pre-computed data. Handlebars is a superset of the Mustache library, that adds a lot of logic and extensibility, making it a more flexible solution, while still retaining full backward compatibility, so that any Mustache templates can work out of the box. Following are the features of Handlebars:
Because of this, Handlebars has become the premier choice when it comes to frontend templates and is currently being used in many of the popular frameworks such as Meteor and Ember.js.
Not to mention the fact that it was built by the legendary Yehuda Katz, who is a core member on projects such as, jQuery, Ruby on Rails, and the Ember.js framework.
