posthtml-modules icon indicating copy to clipboard operation
posthtml-modules copied to clipboard

Feature Request: Use JSON file for locals

Open ghost opened this issue 4 years ago • 1 comments

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.

ghost avatar Jun 05 '21 13:06 ghost

@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.

Scrum avatar Jun 11 '21 07:06 Scrum