rollup-plugin-yaml

Convert .yaml and .yml files to ES6 modules:

This module has been deprecated and is no longer maintained. Please use @rollup/plugin-yaml.
Last updated 6 years ago by lukastaegert .
Original npm · Tarball · package.json
$ cnpm install rollup-plugin-yaml 
SYNC missed versions from official npm registry.

rollup-plugin-yaml

Convert .yaml and .yml files to ES6 modules:

// import a single property from a YAML file
import { foo } from './config.yaml';

// import the whole file as an object
import config from './config.yaml';

Installation

npm install --save-dev rollup-plugin-yaml

Usage

import { rollup } from 'rollup';
import yaml from 'rollup-plugin-yaml';

rollup({
  entry: 'main.js',
  plugins: [
    yaml({
      // All YAML files will be parsed by default,
      // but you can also specifically include/exclude files
      include: 'node_modules/**',  // Default: undefined
      exclude: [ 'node_modules/foo/**', 'node_modules/bar/**' ],  // Default: undefined
      // optionally mutate parsed yaml with a transform function.
      // The transform function may either:
      // - return an updated version of the yaml content
      // - return `undefined`, and mutate the yaml content directly
      transform(data) {
        if (Array.isArray(data))
          return data.filter((element) => !element.private);
      }
    })
  ]
});

License

MIT

Current Tags

  • 2.0.0                                ...           latest (6 years ago)

3 Versions

  • 2.0.0 [deprecated]           ...           6 years ago
  • 1.1.0 [deprecated]           ...           9 years ago
  • 1.0.0 [deprecated]           ...           10 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (4)
Dev Dependencies (8)
Dependents (2)

Copyright 2013 - present © cnpmjs.org | Home |