JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 724125
  • Score
    100M100P100Q222529F
  • License MIT

YAML loader for webpack (converts YAML to JSON)

Package Exports

  • yaml-loader

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (yaml-loader) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

yaml-loader for webpack

YAML loader for webpack. Converts YAML to a valid JSON. If you want a JS Object, chain it with json-loader.

Installation

npm install yaml-loader

Usage

Documentation: Using loaders

Simplest case would be:

var json = require("json!yaml!./file.yml");
// => returns file.yml as javascript object

This loader is also useful for getting a valid JSON from YML. For example:

// webpack.config.js
module: {
  loaders: [
    {
      test: /\.yaml$/,
      include: path.resolve('data'),
      loader: 'yaml',
    },
  ],
}

and then

// applicatin.js
const actualFilename = require(`file?name=[name].json!./../data/${file}.yaml`);
window.fetch(actualFilename).then(res => {
  // ...
});

License

MIT (http://www.opensource.org/licenses/mit-license.php)