patrickkettner / grunt-compile-handlebars

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

One template, Many JSON, outputted into website directory structure. #46

Closed leonbe02 closed 9 years ago

leonbe02 commented 9 years ago

I am a web developer for Nintendo and I am looking for a way to have one template with multiple JSON data files that will be used to create different variations of HTML from that template and outputted in the same directory structure as the input JSON files.

For example:

template: 'src/templates/index.hbs', templateData: 'src/data/*/.json', output: 'dist/*/.html'

Reason: A lot of our websites are static pages with tabs to show different content on the page. For SEO purposes, we would rather not use AJAX to populate the content so we have multiple HTML files instead that are all essentially copy/paste except for the content in the middle. Having one template and multiple JSON would significantly decrease our development time on many of these sites.

I'm going to work on contributing this to the project unless someone already has a branch/fork that accomplishes this.

patrickkettner commented 9 years ago

hey @leonbe02! Pleasure to meet you! How similar is this to #39?

leonbe02 commented 9 years ago

somewhat similar. I'd like to be able to glob the templateData and output fields and have just one template.

patrickkettner commented 9 years ago

have you tried to do this with 1.0.1? what happens currently? I'd be more than happy to land changes to make it nessecary

leonbe02 commented 9 years ago

Using 1.0.1, it will create a single file called 'h.b.s.html' in the dist folder

timhettler commented 9 years ago

Files are currently generated on a per-template basis; needs to be switched to a per-output basis. Will look into changing this today and submitting a pull request.

patrickkettner commented 9 years ago

fixed with f57ee7c3ec8f2107956f26b5655932d3e3ca839d

patrickkettner commented 9 years ago

(thanks, @timhettler!)