htmltemplate-transform

2.1.3 • Public • Published

HTMLTemplate transformations

TravisCI

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);

/htmltemplate-transform/

    Package Sidebar

    Install

    npm i htmltemplate-transform

    Weekly Downloads

    2

    Version

    2.1.3

    License

    MIT

    Last publish

    Collaborators

    • lapple