2.1.4 • Published 10 years ago

dootify v2.1.4

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

dootify

Auto-variablizing browserify plugin to require Twig template files.

installation

Install from npm:

$ npm install dootify

usage

Use it as browserify transform module with -t:

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

Or use it as browserify transform module in gulp:

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

Twig template files (.tmt, .tpl, .html, .twig)

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

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

// main.js
var template = require('../../templates/template.html'); // Twig 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);
});
2.1.4

10 years ago

2.1.3

10 years ago

2.1.2

10 years ago

2.1.1

10 years ago

2.1.0

10 years ago

2.0.2

10 years ago

2.0.1

10 years ago

2.0.0

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago