[![npm][npm-badge]][npm-url] [![github][github-badge]][github-url] ![node][node-badge]
npm install yaml-patch-loader[![npm][npm-badge]][npm-url]
[![github][github-badge]][github-url]
![node][node-badge]
[npm-url]: https://www.npmjs.com/package/yaml-patch-loader
[npm-badge]: https://img.shields.io/npm/v/yaml-patch-loader.svg?style=flat-square&logo=npm
[github-url]: https://github.com/best-shot/yaml-patch-loader
[github-badge]: https://img.shields.io/npm/l/yaml-patch-loader.svg?style=flat-square&colorB=blue&logo=github
[node-badge]: https://img.shields.io/node/v/yaml-patch-loader.svg?style=flat-square&colorB=green&logo=node.js
> A webpack loader that converts YAML to JSON with optional transformation
``bash`
npm install yaml-patch-loader --save-dev
- Converts YAML files to JSON
- Formats output when webpack's optimization.minimize is not true
- Supports callback function to modify JSON content
`cjs`
module.exports = {
module: {
rules: [
{
test: /\.ya?ml$/,
use: {
loader: 'yaml-patch-loader',
options: {
// Optional callback to modify parsed data
modify: (data) => {
// Modify data here
return data;
}
}
}
}
]
}
};
- modify {Function}` (optional): A function that receives the parsed YAML data and returns the modified data.