@bundles/bundles-output

0.2.1 • Public • Published

Bundles Output Bundler

NPM version NPM downloads per month Travis branch Codacy code grade Codacy coverage Coverage Status JavaScript Style Guide code style: prettier semantic release Commitizen friendly License Greenkeeper badge

This is a bundler plugin for use with Bundles. bundles-output outputs the data and content compiled by Bundles to disk.

Environment support

Node CLI ES Module Browser UMD
x x

Install

Make sure Bundles core is installed.

npm install @bundles/bundles-output -D

Usage

See configuring Bundles for details on configuring Bundles.

Configuration

IMPORTANT: Unless you know what you're doing, bundles-output should be the last bundler in the config.bundlers Array, since it should typically run after all other bundlers have run.

The following properties are available in bundler.options:

  • to {String|Function} (required) Directory to output compiled data to. Can be a callback Function which returns a String. If return value is falsy, or is not a String, the file will not be output.
  • root {String} (process.cwd()) Root directory for source input paths. For example, settings of { to: 'output', root: 'my/dir' } with a source input of ['my/dir/one.md', 'my/dir/subdir/two.md'] will output files to output/one.md and output/subdir/two.md.
  • incremental {Boolean} [true] When watching files, whether to utilize the incremental build feature (true) or always output all files (false).
  • fs Options passed to fs-extra's outputFile method, which are the same options passed to node fs's writeFile method. This, for example, gives user control over whether existing files are overwritten. Note: The encoding option is automatically set based on whether the file type is text/utf8 or binary.

Example

// Outputs `src/my/file.md` to `my/dir/my/file.md`.
const bundle = {
  input: 'src/my/file.md',
  bundlers: [
    {
      run: '@bundles/bundles-output',
      options: {
        to: 'my/dir',
        root: 'src',
        incremental: true,
      },
    },
  ],
};

Package Sidebar

Install

npm i @bundles/bundles-output

Weekly Downloads

0

Version

0.2.1

License

MIT

Unpacked Size

8.13 kB

Total Files

4

Last publish

Collaborators

  • thezimmee