Skip to content

open-node/ecofy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ecofy

eco precompiler plugin for Browserify without magic.

Compiles Handlebars templates to plain Javascript. The compiled templates only have one copy of the Handlebars runtime so they are lightweight and fast!

Usage

Install hbsfy locally to your project:

npm install ecofy

Handlebars will be automatically installed as [peer dependency][].

Then use it as Browserify transform module with -t:

browserify -t eco main.js > bundle.js

where main.js can be like:

var template = require("./template.eco");
document.body.innerHTML = template({ name: "Epeli" });

and template.hbs:

<h1>Hello <%=name%>!</h1>

Programmatic usage

When compiling using Javascript code custom extensions can be set:

var ecofy = require("ecofy");

var browserify = require("browserify");
var b = browserify("./index.js");
b.transform(ecofy);
b.bundle().pipe(fs.createWriteStream("./bundle.js"));

Releases

No releases published

Packages

No packages published