@probablyup/esbuild-plugin-yaml
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

esbuild-plugin-yaml

Use YAML files as ES6 modules with esbuild.

Install

yarn add -D esbuild-plugin-yaml

or

npm i -D esbuild-plugin-yaml

Usage

Add to your esbuild plugins list:

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:

yamlPlugin({
  // options
});

loadOptions

LoadOptions by 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).

  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 };
  }

Readme

Keywords

none

Package Sidebar

Install

npm i @probablyup/esbuild-plugin-yaml

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

7.14 kB

Total Files

7

Last publish

Collaborators

  • probablyup