htmltemplate-transform
v2.1.3
Published
Pluggable transforms for HTML::Template
Downloads
54
Readme
HTMLTemplate transformations
Pluggable transforms for HTML::Template.
Installation
npm install htmltemplate-transform
Usage
var path = require('path');
var transform = require('htmltemplate-transform');
// Plugin that inlines external template files into parent.
var include = require('htmltemplate-transform/plugins/include');
// Plugin that expands dot notation into a series of property accessors.
var jpath = require('htmltemplate-transform/plugins/jpath');
var templateFile = path.join(__dirname, 'template.tmpl');
var ast = transform(templateFile)
.using(
include({
includeTags: ['TMPL_INCLUDE'],
resolvePath: function(tagname, from, to) {
return path.resolve(path.dirname(from), to);
}
})
)
.using(jpath()) // Plugins can be chained.
.toAST();
console.log(ast);