terraform
terraform copied to clipboard
Alternatively accept `_data.js` for metadata instead of plain JSON?
Originally: https://github.com/sintaxi/harp/issues/103
This gist works for me (no edge case checks done though, that's for tests).
You have peaked my curiosity, but it still isn't clear to me how one would use this. Can you give me an example of what a typical data.js
might look like?
Sure, I updated the gist with a _data.js
. For such a simple case, the only differences with a _data.json
are the module.exports =
wrapping and the require()
loading stuff from another file (which is what I want).
Just in case, FYI I adjusted the gist code with those fixes:
- live updates to
_data
files weren't picked because ofrequire()
caching - commented out obsolete line in catch block
Just in case anybody would still like to know of use cases for this, there is the fact helper functions could be placed in _data.js. Also, if .coffee was also supported, it would allow a much nicer format for writing it.
Did this ever go anywhere?
I've run into a similar use case (using harp) that would be covered by being able to include JS functions via a _data.js (vs _data.json).
Also, I'd be a fan of allowing .coffee extensions as well though .js itself would be fine.