Skip to content

Lapple/htmltemplate-transform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Pluggable transforms for HTML::Template

Resources

Stars

Watchers

Forks

Packages

 
 
 

Languages