Book Image

Learning Aurelia

By : Manuel Guilbault
Book Image

Learning Aurelia

By: Manuel Guilbault

Overview of this book

<p>Aurelia is one of the most promising new JavaScript frameworks for mobile, desktop, and web, which makes developing powerful, modern web applications a straightforward task. Its power lies in its simplicity and clear workflow that enables developers to build next-generations apps for the web with ease.</p> <p>From initial structuring to full deployment, this book will serve as a step-by-step guide to develop a modern web application from scratch with the Aurelia framework. In addition to including a comprehensive coverage of various Aurelia framework features, this book will also show you how to utilize these features in the real world to develop a professional single-page web application. You’ll see how to make the most out of Aurelia by understanding the Aurelia workflow and then applying it in real-world development tasks. By the end of the book, you will have learned to develop a clean and maintainable application in Aurelia from scratch.</p>
Table of Contents (20 chapters)
Learning Aurelia
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

Preface

The Web evolves very quickly. Technologies come and go, and every couple of years, new ideas emerge and become widely popular, only to be replaced by something else after a while.

If you’ve been doing web development for many years, chances are you’ve seen this cycle go on. Things such as Prototype, and then jQuery, were widely popular in the mid-2000s, and are still used on many projects nowadays.

Then, with the performance of browsers and JavaScript engines getting better and better, the last decade or so have seen the emergence of many full-blown, JavaScript-based frontend frameworks such as Angular and Durandal. More recently, modern frameworks based on different concepts or paradigms such as React and Polymer have gained a lot of popularity.

Aurelia is such a modern framework. The brainchild of Rob Eisenberg, the father of Durandal, it is based on cutting edge Web standards, and is built on modern software architecture concepts and ideas, to offer a powerful toolset and an awesome developer experience.

What this book covers 

Chapter 1, Getting Started, walks you through the basic concepts around Aurelia, and explains how to set up your environment and start a project.

Chapter 2, Layout, Menu, and Getting Familiar, goes further into the concepts at the core of Aurelia, such as dependency injection, logging, and the plugin system. It also explains how to create the main layout and navigation menu of a multi-paged application.

Chapter 3, Displaying Data, guides you through the templating and data-binding system, so you can build complex views.

Chapter 4, Forms, and How to Validate Them, builds on the previous chapter by showing how to build rich forms and how to use Aurelia’s flexible and powerful validation mechanism. It also explores different edition models, such as inline edition or dialog-based edition.

Chapter 5, Making Reusable Components, shows you how to build reusable Aurelia components, such as custom HTML elements and attributes. It also explains how to leverage some cutting edge Web Standards supported by Aurelia, such as the Shadow DOM and content projection.

Chapter 6, Design Concerns – Organizing and Decoupling, walks you through different ways to organize and structure an Aurelia application. It also discusses various techniques to manage communication between decoupled components.

Chapter 7, Test All the Things, teaches you how to write and run automated tests for an Aurelia application, with both unit and end-to-end tests.

Chapter 8, Internationalization, shows you how to internationalize texts and the format of various data types, such as dates and numbers.

Chapter 9, Animations, teaches you how to animate view transitions using CSS, and introduces the general animation API, so you can use richer animation plugins.

Chapter 10, Bundling for Production, shows you how to optimize for production by packaging your application in one or multiple bundles.

Chapter 11, Integrating with Other Libraries, gives examples of how you can integrate various UI libraries into your application, such as Bootstrap widgets, jQuery UI, D3, and Polymer components.

Appendix A, Using JSPM, shows you how to develop, build, and bundle an Aurelia application using SystemJS and JSPM.

Appendix B, Using Webpack, shows you how to develop, build, and bundle an Aurelia application using Webpack.

What you need for this book 

For maximum enjoyment, you will need a PC/laptop running Windows, Linux, or Mac OS X, an Internet connection, and a modern browser. All the code samples were developed and tested using Google Chrome; as such, it is the recommended browser.

All software mentioned in this book is free of charge and can be downloaded from the Internet.

Who this book is for 

This book is for all developers, either keen to learn to build single-page applications using Aurelia, or simply curious about the framework. Some knowledge of JavaScript is ideal to follow the book; however, if you’re new to JS, you’ll pick up most of the basics along the way.

Conventions 

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "As such, in the aurelia_project/aurelia.json file, in the build section, under bundles, let's add the following entries to the dependencies of the bundle named vendor-bundle.js:"

A block of code is set as follows:

{ 
  "name": "aurelia-i18n", 
  "path": "../node_modules/aurelia-i18n/dist/amd", 
  "main": "aurelia-i18n" 
}, 
{ 
  "name": "i18next", 
  "path": "../node_modules/i18next/dist/umd", 
  "main": "i18next" 
}, 
{ 
  "name": "i18next-xhr-backend", 
  "path": "../node_modules/i18next-xhr-backend/dist/umd", 
  "main": "i18nextXHRBackend" 
},

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

<template> 
  <h1 t="404.title"></h1> 
  <p t="404.explanation"></p> 
</template>

Any command-line input or output is written as follows:

> npm install aurelia-i18n i18next --save

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "At this point, if you run the application, click the New button and, for example, put gibberish in the Birthday textbox then try to save."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail [email protected], and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code 

You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support  and register to have the files e-mailed directly to you.

You can download the code files by following these steps:

  1. Log in or register to our website using your e-mail address and password.

  2. Hover the mouse pointer on the SUPPORT tab at the top.

  3. Click on Code Downloads & Errata.

  4. Enter the name of the book in the Search box.

  5. Select the book for which you're looking to download the code files.

  6. Choose from the drop-down menu where you purchased this book from.

  7. Click on Code Download.

You can also download the code files by clicking on the Code Files button on the book's webpage at the Packt Publishing website. This page can be accessed by entering the book's name in the Search box. Please note that you need to be logged in to your Packt account.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR / 7-Zip for Windows

  • Zipeg / iZip / UnRarX for Mac

  • 7-Zip / PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Learning-Aurelia. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at [email protected] with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at [email protected], and we will do our best to address the problem.