doot-loader
Auto-variablizing webpack loader to load Twig template files. Based on dootify.
installation
Install from npm:
$ npm install doot-loader
usage
Use it as webpack loader module:
module: loaders: test: /\.twig$/ loader: 'doot?option1=1'
Twig template files (.tmt, .tpl, .html, .twig)
<!-- template.html --> {{content}}
Require inside main.js and invoke like Twig template. Use it like DOM Element with cached nodes in object fields.
// main.jsvar template = ; // Twig template // Append template with javascriptvar templateDOM = ; // HTML DOM DocumentFragmentdocumentbody; // Bind eventsvar templateButton = templateDOMexampleButton // Cached HTML DOM Element ObjecttemplateButton;