zpl-handlebars
ZPL label templating using Handlebars.
Installation
$ npm i zpl-handlebars
Usage
;; const template = `^XA^FO150,125^ADN,36,20^FD{{data.value1}}^FS^FO100,100^XGR:{{images.myImage}},1,1^FS^XZ`; const compiled = ; // prettier-ignoreconst myImage = 8 4 // Or load any image with Image.load() 0 0 0 0 0 0 0 0 255 0 255 255 0 255 255 255 255 255 0 255 255 255 255 0 255 255 255 255 255 255 255 255 // @ts-ignore kind: 'GREY' ; const zpl = ;/*~DGR:00000000.GRF,4,1,FF482100^XA^FO150,125^ADN,36,20^FDTEST^FS^FO100,100^XGR:00000000.GRF,1,1^FS^XZ*/
Helpers
toFixed
Formats a value using Number(value).toFixed(decimals)
.
The decimals
parameter is optional and defaults to 2
.
{{toFixed data.value}}
{{toFixed data.value 3}}