rollup-plugin-copy-assets-to
v1.0.0
Published
Copy additional assets into a directory you choose.
Downloads
854
Maintainers
Readme
rollup-plugin-copy-assets-to
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