rollup-plugin-copy-assets-to

1.0.0 • Public • Published

rollup-plugin-copy-assets-to

build status npm version

Copy additional assets into a directory you choose.

Installation

with npm

npm install --save-dev rollup-plugin-copy-assets-to

with Yarn

yarn add --dev rollup-plugin-copy-assets-to

Usage

// rollup.config.js
import copyTo from 'rollup-plugin-copy-assets-to';

export default {
  entry: 'src/index.js',
  dest: 'dist/bundle.js',
  plugins: [
    copy({
      assets: [
        './src/assets',
        './src/external/buffer.bin',
        './src/component/assets/image.png',
      ],
      outputDir: 'dist/allAssets'
    }),
  ],
};

On final bundle generation the provided files will be copied over into the folder chosen with outputDir.

# Source directory structure
src/
- index.js
- component/
  - assets/
    - image.png
- assets/
  - some-library-needing-special-treatment.js
- external/
  - buffer.bin

# Output directory structure
dist/
- bundle.js
- allAssets/
  - some-library-needing-special-treatment.js
  - image.png
  - buffer.bin

Options

  • assets: (required) An array of paths to copy. Accepts files as well as directories.
  • outputDir: (optional) Path to the directory where assets will be copied to (defaults to bundle output location).

License

MIT

Package Sidebar

Install

npm i rollup-plugin-copy-assets-to

Weekly Downloads

204

Version

1.0.0

License

MIT

Unpacked Size

6.33 kB

Total Files

7

Last publish

Collaborators

  • jonshort