HAG supports three types of output; text, JSON, and image (PNG).
HAG can generate any type of text template (assumes utf-8).
{
"asset": "example-text-asset.md",
"template": "/example-text-template.hbs",
"renderer": {
"type": "text"
},
"data": {
"$ref": "/data/example-data.json"
}
}
HAG makes a special case for JSON data so that it can be formatted nicely. Note: no template is required for the JSON renderer.
{
"asset": "example-json-asset.json",
"renderer": {
"type": "json",
"spacing": " "
},
"data": {
"expected-output": {
"$ref": "/data/example-data.json"
}
}
}
HAG is primarily aimed at generating using images from HTML/CSS templates. It uses the webshot
API which in turn runs on top of phantom
.
Example using webshot render
{
"asset": "example-image-asset.png",
"template": "/example-html-template.hbs",
"renderer": {
"type": "webshot",
"size": {
"width": 640,
"height": 960
}
},
"data": {
"$ref": "/data/example-data.json"
}
}