Yeah, handlebars works really well indeed in https://github.com/gextech/raml2code it is the core of the project, we solved the problem of the path with gulp.js.
Basically raml2code it's a gulp plugin and it's main responsibility it's to orchestrate the input streams (RAML file) and the output (Files generated).
Please review this file:
Also all the handlebars things is done whit this:
It's main responsibility it to handle partials, templates, helper sand partial, and a parser.
The combination of partials, templates, helper sand partial, and a parser is a generator.
For example this is our generator for pojos:
If you see:
generator.template = require("./tmpl/jaxrsResources.hbs") --> Template
generator.parser = (data) -> Parser
The parser function return a object where each key represent a File
result["POJO.groovy"] = model
and then raml2code write to file here:
And all this stuff is done, to make easier to write generators, and just worry about parsers and templates.