patrickkettner / grunt-compile-handlebars

grunt plugin to compile static html from a handlebars plugin
MIT License
115 stars 29 forks source link

Added a very useful wildcard based batch task #3

Closed arne-strout-icrossing closed 11 years ago

arne-strout-icrossing commented 11 years ago

This second pattern based task allows the use of a pattern for filenames to parse, also added grunt.template.process calls to allow the use of package.json values (or any other underscore code) to dynamically create paths if desired. More details in the comments in the file.

Basically it is intended for environments where you have a one to one data file to base template pairing over multiple files which match a pattern. In the case where I'm using it, the files are organized this way:

app/index.hbr app/hbr-context/index.json ... etc

So I can add the task 'grunt-compile-handlebars-pattern' to grunt with the following config: development:{ files: 'app//.hbr', data: 'hbr-context/.json', replaceDir:'app/', withDir:'dist/' }

This will find all .hbr files in my app folder, look for a .json file under the relative hbr-context folder with the same name, and render an html file with the same name into the 'dist/' folder.

Let me know what you think :)

patrickkettner commented 11 years ago

sounds great, i'll check it out soon.

thanks a ton!