Skip to content

sparkartgroup/parcel-plugin-handlebars-precompile

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

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 [email protected] run without sourcemap generation:

parcel index.html --no-source-maps

build:

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

Credits

About

Precompiel handlebars templates

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%