0.1.2 • Published 7 years ago

yaml-to-jsonp-loader v0.1.2

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

yaml-to-jsonp-loader

YAML loader for webpack (converts YAML to JSONP)

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

Installation

npm install yaml-to-jsonp-loader

Usage

Documentation: Using loaders

Simplest case would be:

var json = require("json-loader!yaml-to-jsonp-loader!./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: /\.(yml|yaml)$/,
        use: [{
             loader: 'file-loader',
             options: {
               name: '[folder]/[name].json',
               context: 'src'
              }
            },{
              loader: 'yaml-to-jsonp-loader' 
            }]
      },
  ],
}

License

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