Dimples
JavaScript and HTML templates can be just as cute as pair of dimples!
Intro
A build step that manages Pug templates for use in JavaScript applications. Here's a demo of it being used.
Installation
via npm
npm i dimples --save
Example
Input (app.js
)
documentbodyinnerHTML = '@tpl.Master';
build step
var dimples = fs = ; fs;
becomes (output.js
)
var $dimples = { return d == void 0 ? data: {} { return thisdataa; } { for var key in tpls if tpls thisdatakey = tplskey; } : d;}$dimples; $dimples; documentbodyinnerHTML = $dimples;
API
constructor(input: Buffer|string, options: Config)
input
is either a Buffer or a string of the source JavaScript
options
is an object containing 1 required property: views
which is the directory of where to start finding templates. Also specify a compress
property, which will compress the output of the dimples manager.
.compile(void): Buffer
Returns a Buffer of the new source with pug templates.
.code: string
Returns a string of the new source with pug templates.
Build
npm i typscript typings -g
npm i
typings i
npm run build
License
Copyright(c) 2016 Marais Rossouw