$ cnpm install @expo/template-file
@expo/template-file
provides file-level variable substitution (Mustache template style).
templateFile(templateFilePath: string, outputFilePath: string, envs: Record<string, string | number>): Promise<void>
import templateFile from '@expo/template-file';
await templateFile('abc.json.template', 'abc.json', { ABC: 123, XYZ: 789 });
abc.json.template
file contents:
{
"someKey": {{ ABC }},
"anotherKey": {{ XYZ }}
}
abc.json
file should be created with the following contents:
{
"someKey": 123,
"anotherKey": 789
}
https://github.com/expo/turtle-v2/tree/master/src/libs/template-file
Copyright 2014 - 2016 © taobao.org |