Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/martonlederer/esbuild-plugin-yaml
Convert YAML files to ES6 modules
https://github.com/martonlederer/esbuild-plugin-yaml
Last synced: 3 months ago
JSON representation
Convert YAML files to ES6 modules
- Host: GitHub
- URL: https://github.com/martonlederer/esbuild-plugin-yaml
- Owner: martonlederer
- License: mit
- Created: 2021-02-20T18:49:11.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-05-12T15:37:15.000Z (over 1 year ago)
- Last Synced: 2024-04-29T14:01:32.710Z (7 months ago)
- Language: JavaScript
- Size: 24.4 KB
- Stars: 5
- Watchers: 1
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# esbuild-plugin-yaml
Use YAML files as ES6 modules with `esbuild`.
## Install
```sh
yarn add -D esbuild-plugin-yaml
```or
```sh
npm i -D esbuild-plugin-yaml
```## Usage
Add to your esbuild plugins list:
```js
const esbuild = require("esbuild");
const { yamlPlugin } = require("esbuild-plugin-yaml");esbuild.build({
...
plugins: [
yamlPlugin()
]
...
});
```## Options
You can add your own custom configuration of options to `esbuild-plugin-yaml`:
```js
yamlPlugin({
// options
});
```### `loadOptions`
LoadOptions by [`js-yaml`](https://www.npmjs.com/package/js-yaml).
### `transform`
A function which can mutate parsed YAML. It should return an `object` or `undefined` (that will make no changes to the parsed YAML).
```js
transform(data, filePath) {
// transform the yaml file
// the file content will be in the "data" field
// the file path will be in the "filePath" field
return { filePath, data };
}
```