https://github.com/codemix/handlebarsgen
An extendable static code generator for handlebars templates, targetting languages other than JavaScript, e.g. PHP
https://github.com/codemix/handlebarsgen
Last synced: 8 months ago
JSON representation
An extendable static code generator for handlebars templates, targetting languages other than JavaScript, e.g. PHP
- Host: GitHub
- URL: https://github.com/codemix/handlebarsgen
- Owner: codemix
- Created: 2013-05-27T13:08:40.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2013-06-07T22:22:55.000Z (almost 13 years ago)
- Last Synced: 2025-06-24T13:51:13.585Z (9 months ago)
- Language: CoffeeScript
- Size: 191 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# handlebars-gen
Extensible ahead-of-time (AOT) template transpiler for Handlebars, targeting languages other than JavaScript, e.g. PHP.
# Installation
npm install handlebars-gen -g
# Usage
Can be used via the command line:
handlebars-gen --target php --output ./compiled ./src
use `handlebars-gen --help` for more information on individual commands.
Or as a library from within your node.js application:
var Gen = require("handlebars-gen");
var generator = new Gen.Generator({
target: Gen.Targets['php']
});
fs.readFile("path/to/template", "utf8", function(err, data){
if (err) throw err;
var ast = generator.generate(data);
console.log(ast.toString()); // the compiled output
console.log(JSON.stringify(ast, null, 2)); // the node structure
});