posthtml / posthtml-modules

Modules Plugin
MIT License
84 stars 11 forks source link

Feature Request: Use JSON file for locals #71

Open ghost opened 3 years ago

ghost commented 3 years ago

Hi,

I'm using posthtml with modules to structure a static website, and I thought it would be useful if we could specify a path to a JSON file for the locals attribute, instead of including the data object directly in the template. It would make it easier to reference the same data in multiple places if you want to use different templates with the same information.

E.g. locals="/data/my-page-data.json"

Is this something that is easily achieved?

Regards, Rob.

Scrum commented 3 years ago

@jazael0 Hello, the idea is interesting, but I think you still unload the data beforehand by passing it as options, and you can reuse it anywhere in the same way.

Perhaps it will suit you if you need to use different scopes in different parts of the component.