{"name":"yaml-loader","version":"0.2.0","description":"YAML loader for webpack (converts YAML to JSON)","main":"index.js","repository":{"type":"git","url":"git+https://github.com/okonet/yaml-loader.git"},"keywords":["yaml","webpack","loader","json"],"author":{"name":"Andrey Okonetchnikov","email":"andrey@okonet.ru"},"license":"MIT","bugs":{"url":"https://github.com/okonet/yaml-loader/issues"},"homepage":"https://github.com/okonet/yaml-loader","dependencies":{"js-yaml":"^3.5.2"},"gitHead":"b2aec633b3b368b730c83d27238914037a14543d","_id":"yaml-loader@0.2.0","scripts":{},"_shasum":"965c319a053af701590ce0954305d03ebdb08ac3","_from":".","_npmVersion":"3.6.0","_nodeVersion":"5.1.0","_npmUser":{"name":"okonet","email":"andrey@okonet.ru"},"maintainers":[{"name":"okonet","email":"andrey@okonet.ru"}],"dist":{"shasum":"965c319a053af701590ce0954305d03ebdb08ac3","tarball":"http://registry-npm.ywwl.com/yaml-loader/download/yaml-loader-0.2.0.tgz","integrity":"sha512-SaIwKBVrcXj0xKzKo7T/BDCCU1A3V02lWfSeKKCBcZsq7ZQfvwrkN/YBuKNrvPYP5RkDwqxa8OTzaOLIZEhtjw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICZm5TihcJHR1i97boRB7384L5AWj1L9BZidAOpS2mswAiEAuk6TVB7qbqd+g7Z5AFbiD8XfhVH2Oo3sCTIus5XB68I="}],"size":1787,"noattachment":false,"key":"/yaml-loader/-/yaml-loader-0.2.0.tgz"},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/yaml-loader-0.2.0.tgz_1463040402077_0.7978495450224727"},"directories":{},"readme":"# yaml-loader for Webpack\n\nYAML loader for [Webpack](https://webpack.js.org/). Allows importing YAML files as JS objects. Uses [`yaml`](https://www.npmjs.com/package/yaml) internally.\n\n## Installation\n\n```sh\nnpm install --save-dev yaml-loader\n```\n\n## Usage\n\n```js\n// webpack.config.js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.ya?ml$/,\n        use: 'yaml-loader'\n      }\n    ]\n  }\n}\n```\n\n```yaml\n# file.yaml\n---\nconfig:\n  js:\n    key: test\nhello: world\n```\n\n```js\n// application.js\nimport file from './file.yaml'\n\nfile.hello === 'world'\n```\n\n## Options\n\nIn addition to all [`yaml` options](https://eemeli.org/yaml/#options) used by its parsing methods,\nthe loader supports the following additional options:\n\n### `asJSON`\n\nIf enabled, the loader output is stringified JSON rather than stringified JavaScript. For Webpack v4, you'll need to set the rule to have `type: \"json\"`. Also useful for chaining with other loaders that expect JSON input.\n\n### `asStream`\n\nIf enabled, parses the source file as a stream of YAML documents. With this, the output will always be an array, with entries for each document. If set, `namespace` is ignored.\n\nTo use this option for only some YAML files, it's probably easiest to use a query parameter and match that using [Rule.resourceQuery](https://webpack.js.org/configuration/module/#ruleresourcequery):\n\n```js\n// webpack.config.js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.ya?ml$/,\n        oneOf: [\n          {\n            resourceQuery: /stream/,\n            options: { asStream: true },\n            loader: 'yaml-loader'\n          },\n          { loader: 'yaml-loader' }\n        ]\n      }\n    ]\n  }\n}\n```\n\nThen, importing `./foo.yaml` will expect it to contain only one document, but `./bar.yaml?stream` may contain multiple documents.\n\n### `namespace`\n\nAllows for exposing a sub-tree of the source document:\n\n```js\nimport jsCfg from './file.yaml?namespace=config.js'\n\njsCfg.key === 'test'\n```\n\nThe `namespace` should be a series of keys, dot separated. Note that any `options` object in your `webpack.config.js` rule will be superseded by a `?query`.\n\n## License\n\n[MIT](http://www.opensource.org/licenses/mit-license.php)\n","publish_time":1463040403694,"_cnpm_publish_time":1463040403694,"dist-tags":{"latest":"0.9.0"}}