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: about 2 months ago
JSON representation
Precompiel handlebars templates
- Host: GitHub
- URL: https://github.com/belicekm/parcel-plugin-handlebars-precompile
- Owner: belicekm
- License: mit
- Created: 2018-05-22T18:51:48.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T08:55:10.000Z (almost 2 years ago)
- Last Synced: 2024-11-14T13:44:26.108Z (about 2 months ago)
- Topics: handlebars, parcel, parcel-bundler
- Language: JavaScript
- Size: 883 KB
- Stars: 16
- Watchers: 0
- Forks: 5
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-parcel - Handlebars precompile - Plugin to precompile handlebars templates into template functions. (Plugins / Templates)
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.