1.0.2 • Published 4 years ago

parcel-plugin-handlebars-precompile v1.0.2

Weekly downloads
44
License
ISC
Repository
github
Last release
4 years ago

parcel-plugin-handlebars-precompile

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.

Install

npm install --save-dev parcel-plugin-handlebars-precompile

NOTE to version 1.0.2

  • Fully compatible with parcel-bundler@1.11.0.
  • Partially compatible with parcel-bundler@1.12.x

    source map generation must be disabled eg: parcel build index.html --no-source-maps.

Usage

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

With parcel-bundler@1.12.x run without sourcemap generation:

parcel index.html --no-source-maps

build:

parcel build index.html --no-source-maps

Credits

1.0.2

4 years ago

1.0.1

5 years ago

1.0.0

6 years ago

0.2.0

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago