Use aura:template to Create App Templates

You can customize Aura application by extending your own template. For this you can create a template by extending component.

Syntax to create template:-
First create a aura component and set isTemplate attribute true and extends “aura:template” component.
aura:template component contains some attribute like title, loadingText, errorTitle, errorMessage, defaultBodyClass, doctype and bodyClass. You can read detail about all attribute on salesforce.


<aura:component isTemplate="true" extends="aura:template">
    <aura:set attribute="title" value="Salesforce XYZ"/>
    <aura:set attribute="loadingText" value="Loading my App Name"/>
    <aura:set attribute="errorTitle" value="Custom Error Title"/>
	<!-- you can write custom css for loading text message-->
	<aura:html tag="style">
        font-family: 'Salesforce Sans',Arial,sans-serif;
        display: block;
        line-height: 1.5;
        margin: 0;
        font-size: .8125rem;
        background: transparent;
        color: rgb(22, 50, 92);
        -webkit-tap-highlight-color: transparent;
        .auraMsgBox {        
            background-repeat: repeat-x;
            background-position: top left;        
            width: 350px;
        	height: 75px;
            border: none;
            box-shadow: none;
        .auraMsgBox h2 {
        	color: #fff;

Use template in your application

<aura:application extends="force:slds" template="c:MyTemplate">
   <p>Using my own template</p> 

When application loading->
aura:template lightning

Modules in ES5 and ES6 (JavaScript)

A module is  piece of code that is executed once it is loaded. Modules first introduce in ES5 and event adopted by ES6. A module can be declared as variable or function. By default module declaration is local to file. You can make some of them as public by export keyword and import them in other file by import keyword.

The basics of ES6 modules

There are two kinds of exports: named exports (several per module) and default exports (one per module).

1. Named exports (several per module):-

A module can export multiple things(Variable and Function) by using export keyword declaration.


export const sqrt = Math.sqrt;
export function square(x) {
    return x * x;
export function diag(x, y) {
    return sqrt(square(x) + square(y));


import { square, diag } from 'utils';
console.log(square(5)); // 25
console.log(diag(4, 3)); // 5

You can also import all modules using *.

import * as lib from 'utils';
console.log(lib.square(5)); // 25
console.log(lib.diag(4, 3)); // 5

2. Default exports (one per module):-

If we want to export a single value or to have a fallback value for your module, you could use a default export:
// module “utils.js”

export default function cube(x) {
  return x * x * x;

default export module very easy to import like

import cube from './my-module.js';
console.log(cube(3)); // 27

There are two styles of default exports:
1. Labeling declarations
You can prefix any function declaration or class declaration with the keywords export default to make it the default export:

export default function myFunct() {} // no semicolon!
export default class MyClass{} // no semicolon!

Or you can omit function name. That makes default exports the only place where JavaScript has anonymous function declarations and anonymous class declarations:

export default function () {} // no semicolon!
export default class {} // no semicolon!

2. Default export style 2: default-exporting values directly
The values are produced via expressions:

export default 'SalesforceXYZ';
export default XYZ();
export default /^xyz$/;
export default 5 * 7;
export default {yes: true,no: false};