W3cubDocs

/Handlebars.js

Installation

There are many different ways to install and use Handlebars, the following are some of the more popular. Please send pull requests if we are missing one!
The fastest route is to manually download the package and copy into your project but a number of other systems are available. Download: 4.0.12 Download: runtime-4.0.12

NPM

Handlebar's npm package includes both libraries suitable for CommonJS aware systems and built browser libraries that can be consumed direct browser mechanisms.
npm install --save handlebars
Require-aware systems such as Node and Webpack can then load via:
require('handlebars');
or for the runtime only:
require('handlebars/runtime');
The browser builds are located in the node_modules/handlebars/dist/ directory. Making these accessible to the browser will depend on what build system you are using but this may be as simple as copying the files to an acessible place.
This is the preferred method of installation when using the precompiler as it ensures that your precompiled templates always run against the same version of the runtime.

Bower

Handlebars maintains a bower component as well that is available for bower users. This can be installed in a project like so.
bower install --save handlebars
The default bower library is UMD-style so this should work properly with global, CJS, and AMD module systems. handlebars.js and handlebars.runtime.js are the primary source files but a number of other options exist in this component. We recommend looking at them and selecting the best one for your needs.
This component should also work with other packagers such as component but these have not been tested as throughly.

Manual Download

All of Handlebar's released versions and CI builds are available for download on S3 in our builds page.
The latest passing master build is named handlebars-latest.js and each passing SHA on master will create a handlebars-gitSHA.js file. While these all pass the CI, it's preferrable to use one of the tagged releases.
**Note**: The S3 builds page is provided as a convenience for the community, but you should not use it for hosting Handlebars in production.

CDNs

Handlebars is hosted on a number of free CDNs as well.

© 2011–2017 by Yehuda Katz
Licensed under the MIT License.
https://handlebarsjs.com/installation.html