Allows import files in YAML.
This plugin requires an LTS Node version (v10.0.0+).
Using npm:
$ npm i js-yaml js-yaml-import -D
Using yarn:
$ yarn add js-yaml js-yaml-import -D
# ./src/foo.yaml
Media:
Anime: foo
# ./src/bar.yaml
'@import':
- baz.yaml
Media:
VideoGames: bar
# ./src/baz.yaml
Media:
FilmAdaptation: baz
# ./src/data.yaml
'@import':
- foo.yaml
- bar.yaml
Media:
Webcomic: aaa
Manga: bbb
const path = require('path');
const Yaml = require('js-yaml-import');
const yaml = new Yaml(path.join(__dirname, 'src'));
const yamlFile = yaml.read(path.join(__dirname, './src/data.yaml'));
console.log('data =', yamlFile);
// data = {
// Media: {
// Anime: 'foo',
// FilmAdaptation: 'baz',
// VideoGames: 'bar',
// Webcomic: 'aaa',
// Manga: 'bbb'
// }
// }
Type: string | string[]