Skip to content

Vanilla-IceCream/js-yaml-import

Repository files navigation

js-yaml-import Build Status Coverage Status

Allows import files in YAML.

Requirements

This plugin requires an LTS Node version (v10.0.0+).

Install

Using npm:

$ npm i js-yaml js-yaml-import -D

Using yarn:

$ yarn add js-yaml js-yaml-import -D

Usage

# ./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'
//   }
// }

Options

searchPaths

Type: string | string[]

About

Allows import files in YAML like CSS.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published