ecofy

1.0.1 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i ecofy

Weekly Downloads

3

Version

1.0.1

License

MIT

Last publish

Collaborators

  • stonephp