sagold / handlebars-webpack-plugin

Renders your html-template at build time
161 stars 45 forks source link

json #40

Open jw-miaem opened 6 years ago

jw-miaem commented 6 years ago

Hi,

This is related to this issue

For me a really good solution would be to keep the data json source but add the ability to have an array of json files and then in addtion have a pageJson that would use [name].json in the same way the output html does at the moment:

output: path.join(process.cwd(), "build", "[name].html"),

so

pageJson: path.join(process.cwd(), "src/hbs/templates", "[name].json"),

Would this be an easy feature to add? I might fork if I have time

Thanks

brightpixels commented 5 years ago

I am looking for something like "pageJson" too. I have several .hbs files that I want to build but each one has a corresponding json file.

sagold commented 5 years ago

Just a reminder: You can use multiple handlebars-webpack-plugins to assign specific json-data to templates.

As for globbing json, i will not support this, since there are too many variations to thoroughly support this feature and there are multiple ways to do this manually.