Precompile handlebars templates into javascript allowing them to be imported as a regular javascript source. It is up to you how and when the template will be rendered.
npm install --save-dev parcel-plugin-handlebars-precompile
Import your handlebars template:
// index.js
import templateFunction from './template.hbs';
document.body.innerHTML = templateFunction();
Import index.js
from your index.html
file:
<!DOCTYPE html>
<html>
<!-- index.html -->
...
<body>
<script src="./index.js"></script>
</body>
...
</html>
Run the parcel bundler:
parcel build index.html
- Handlebars - A templates on steroids.
- Parcel - Zero configuration bundler.