js-yaml-type-include

Custom type for js-yaml to include other files

Usage no npm install needed!

<script type="module">
  import jsYamlTypeInclude from 'https://cdn.skypack.dev/js-yaml-type-include';
</script>

README

js-yaml-type-include

Use it like this:

import { createType } from 'js-yaml-type-include'

const type = createType({
  relativeTo: './path', // is optional and defaults to the current directory
})
const schema = new yaml.Schema({
  include: [yaml.DEFAULT_SAFE_SCHEMA],
  explicit: [type],
})
const parsed = yaml.load(
  `
includedFile: !!data "file.txt"
`,
  { schema }
)