1.5.0 • Published 9 years ago

doomify v1.5.0

Weekly downloads
1
License
ISC
Repository
github
Last release
9 years ago

doomify

Auto-variablizing browserify plugin to require Mustache template files.

installation

Install from npm:

$ npm install doomify

usage

Use it as browserify transform module with -t:

$ browserify -t doomify main.js -o bundle.js

Or use it as browserify transform module in gulp:

browserify({
  entries: 'main.js',
  debug: true,
  transform: [
    'doomify'
  ]
});

Mustache template files (.dmt, .tpl, .html)

<!-- template.html -->
<div class="example">
  {{content}}
  <div class="button" data-doomify="exampleButton"></div>
</div>

Require inside main.js and invoke like Mustache template. Use it like DOM Element with cached nodes in object fields.

// main.js
var template = require('../../templates/template.html'); // Mustache template

// Append template with javascript
var templateDOM = template({content: 'Hello'}); // HTML DOM DocumentFragment
document.body.appendChild(templateDOM);

// Bind events
var templateButton = templateDOM.exampleButton // Cached HTML DOM Element Object
templateButton.addEventListener('click', function(){
  alert(1);
});
1.5.0

9 years ago

1.4.2

9 years ago

1.4.1

10 years ago

1.4.0

10 years ago

1.3.0

10 years ago

1.2.2

10 years ago

1.2.1

10 years ago

1.2.0

10 years ago

1.1.0

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago