rollup-plugin-copy2

0.4.0 • Public • Published

rollup-plugin-copy2

Rollup plugin to copy additional assets to the build directory.

This plugin actually does not copy assets by default but adds them to the resulting bundle so they could be accessed by other plugins (for example by the rollup-plugin-zip).

The actual copying is made by the Rollup itself.

Install

npm i -D rollup-plugin-copy2

Usage

// rollup.config.js

import {copy} from 'rollup-plugin-copy2'

export default {
  input: 'index.js',
  output: {
    dir: 'dist',
    format: 'es',
  },
  plugins: [
    copy({
      assets: [
        'README.md',
        ['data.txt', 'assets/data.txt'],
      ]
    }),
  ],
}

Options

assets

Type

(string | [string, string])[]

An array of assets to copy. Each entry can be

  • a string that contains a relative path to the source file
  • a glob compatible path resulting to one or some files like node_modules/static-deps/**/*.css
  • a pair of strings [string, string] that contains relative paths to the source (not glob ones) and destination files.

If an entry is a single string then the destination file path will be equal to it (relative to the output directory).

notEmitFiles

Type

boolean?

Do not emit files with Rollup. Use this option with outputDirectory if you only want to copy files to a specific directory.

outputDirectory

Type

string?

A path to the additional output directory in case you want to write copied files on disk.

If not set, the files are only emitted to the others plugins.

License

MIT © Petr Tsymbarovich

Readme

Keywords

Package Sidebar

Install

npm i rollup-plugin-copy2

Weekly Downloads

94

Version

0.4.0

License

MIT

Unpacked Size

10.5 kB

Total Files

6

Last publish

Collaborators

  • mentaljam