A grunt-based command line tool to render HMTL and PDF from JSON and HTML templates. Uses Underscore.js template engine, already included with Grunt.
- Clone this repo :
git clone https://github.com/dharFr/static-templater.git && cd static-templater
- Have a look to the
projects/sample
folder - Create a new folder into the
projects
one - Create your own
.json
and template-ready.html
files. Save them into the new folder you just created. Take care about the folder stucture. It should be the same than the one inprojects/sample
static-templater/
|- projects/
|- your-project/ # your project lives in his own folder
|- data/ # contains one or more json files
|- templates/ # contains one or more template folders
| |- firsttemplate/
| |- secondtemplate/
|- out/ # generated from templates and data
|- firsttemplate/
|- secondtemplate/
grunt template
will generate HTML files for each projects. Files are generated from json
data and HTML template.
grunt template:projects/your-project/
will generate HTML files for the specified sub-folder only.
grunt wkhtmltopdf
will generated PDF files from generated HTML files.
grunt wkhtmltopdf:projects/your-project/
will generate PDF files for the specified sub-folder only.
grunt watch
watch for changes on any project an re-generate HTML and PDF files.
grunt watch:projects/your-project/
watch for changes on the specified project an re-generate HTML and PDF files.
Add a grunt init task to create a new project.