@sanktionsfrei/shared-fax-template

3.2.5Β β€’Β PublicΒ β€’Β Published

shared-fax-template

πŸ“˜ Main fax template to be shared between frontend & backend and to be consumed by handlebars

The idea behind this is that we can share the main template between the cronjobs and the frontend, making it easier for everyone to maintain the text content.

This includes the regular node build and one build for the browser.

Browser

Include ./dist/fax-template.js as script in your HTML page. It exports the precompiled template to Handlebars.templates.fax

<html>
  <body>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.6/handlebars.runtime.min.js"></script>
    <script src="/assets/shared-fax-template/dist/fax-template.js"></script>
    <script>
      console.log(Handlebars.templates.fax({firstName: 'Robin'}))
    </script>
  </body>
</html>

Node

In node it's exported as regular CommonJS module.

package.json

"dependencies": {
  "shared-fax-template": "sanktionsdev/shared-fax-template"
}

Your code

const Handlebars = require('handlebars')
const faxTemplate = require('shared-fax-template')

const template = Handlebars.compile(window.faxTemplate)
console.log(template({firstName: 'Robin'}))

Readme

Keywords

none

Package Sidebar

Install

npm i @sanktionsfrei/shared-fax-template

Weekly Downloads

0

Version

3.2.5

License

UNLICENSED

Unpacked Size

30.1 kB

Total Files

7

Last publish

Collaborators

  • jan
  • rmehner
  • espy
  • sanktionsfrei
  • spielhoelle
  • tspielhoelle
  • mcmeeks