yaml.macro
v0.2.0
Published
A Babel macro for loading YAML files
Readme
yaml.macro
A Babel macro for loading YAML files.
npm install --save-dev yaml.macroSource:
# file.yaml
- YAML file
- with: some contentsimport yaml from 'yaml.macro'
const foo = yaml('./file.yaml')Result:
const foo = ['YAML file', { with: 'some contents' }];yaml(path: string, options?: {}): any
Relative path values should start with .. Internally, the macro uses yaml and supports its parser options as a second argument. As the macro arguments are evaluated at build time, they should not be dynamically modified by preceding code.
Multiple calls to load the same YAML file will not be cached.
