Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/belicekm/parcel-plugin-handlebars-precompile

Precompiel handlebars templates
https://github.com/belicekm/parcel-plugin-handlebars-precompile

handlebars parcel parcel-bundler

Last synced: 5 days ago
JSON representation

Precompiel handlebars templates

Lists

README

        

# 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

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

#### NOTE to version 1.0.2
- Fully compatible with `[email protected]`.
- Partially compatible with `[email protected]`
> source map generation must be disabled eg: `parcel build index.html --no-source-maps`.

# Usage

Import your handlebars template:

```javascript
// index.js
import templateFunction from './template.hbs';
document.body.innerHTML = templateFunction();
```

Import `index.js` from your `index.html` file:

```html


...



...

```

Run the parcel bundler:

```bash
parcel build index.html
```

With `[email protected]` run without sourcemap generation:
```bash
parcel index.html --no-source-maps
```
build:
```bash
parcel build index.html --no-source-maps
```

# Credits
- [Handlebars](https://handlebarsjs.com/) - A templates on steroids.
- [Parcel](https://parceljs.org/) - Zero configuration bundler.