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