node-hag
v1.6.0
Published
Node HTML Asset Generator (HAG) - converts HTML and CSS templates into rendered Image assets, and can also produce Text and JSON assets.
Downloads
10
Readme
HTML Asset Generator (HAG)
The generator processes instructions
to render
assets
based on templates
combined with data
.
Supports rendering of HTML to Images using webshot
, and creation of text based assets such as JSON, CSS, and HTML using Handlebar templates.
Key terms
- Instruction - a JSON block that specifies what to render
- Asset - a useful item to be generated, such as an image, HTML, text, or JSON file
- Template - a cookie-cutter layouts that can be fed with data
- Renderer - the method used to combine the template, with the data, and then save it out as an asset
- Data - JSON data that can be fed into templates to create an asset
Project structure
generator.js
- the entry point to run the generatorbuild
- the target directory for produced assetstemplates
- a folder of usable templatestemplates/template-name
- an individual templateinstructions
- a folder full of data to be rendered
Installation
npm install node-hag -g
Getting started
- Run
hag --help
to view up-to-date Help and Instructions - Run
hag init
to create an example project in the current working directory - Run
hag generate
to compiled the instructions and generate assets
If that all worked as expected, take a closer look at the instructions
folder, and the resulting build
folder to see the generated assets.
Guides
- Command line arguments
- Instructions, data, and templates
- Output formats; text, json, image
- Samples and use cases
Development
- Checkout the project, run
npm install
- Run
npm test
Changelog
See: CHANGELOG.md