npm.io
2.4.3 • Published 9 months ago

multi-yaml-loader

Licence
MIT
Version
2.4.3
Deps
5
Size
1.4 MB
Vulns
0
Weekly
0

multi-yaml-loader

Webpack loader for YAML files with !include tag support. Based on github.com/eemeli/yaml

Usage

install

npm install multi-yaml-loader --save 
webpack.config.js
{
    ...

    module: {
    
        ...
    
        rules: [
            
            ...
            
            {
                test: /\.ya?ml$/,
                use: 'multi-yaml-loader'
            }
        ]
    }
}
file.yaml
title: Main file
sub: !include './relative/path/to/sub.yaml'
# cycle includes also possible, for example
# self: ./file.yaml
src.js
/**
 * Result by default contains JSON with included documents as objects crosslinks (maybe cyclic =)
 */
const yaml = require('./path/to/file.yaml');
YamlIncludeError

Module defines YamlIncludeError extends Error

test
npm test

LICENSE

MIT