750 B
750 B
select data from an external source with Ori and close over it
Say we have a file somewhere else with all our clients:
#clients.yaml
client1:
name: James Jamm
email: james@jamfactory.com
client2:
name: Sammy Sauk
email: sam@sockfactory.com
We want to maintain our client database in one place, and get client data for each of their websites without exposing other clients' data.
We can do this with function in an ori expression file. The function takes a clientid, and returns just that client. Origami's syntax supports passing an argument to a data file as if it were a function.
//clientdata.ori
(clientid) => /path/to/clients.yaml(clientid)
To get just James Jamm's data: ori 'clientdata.ori("client1")'