rollup-plugin-copy-assets-to
Version:
Copy additional assets into a directory you choose.
72 lines (56 loc) • 1.51 kB
Markdown
 [](https://www.npmjs.com/package/rollup-plugin-copy-assets)
Copy additional assets into a directory you choose.
_with npm_
```bash
npm install --save-dev rollup-plugin-copy-assets-to
```
_with Yarn_
```bash
yarn add --dev rollup-plugin-copy-assets-to
```
```js
// 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.
```bash
src/
- index.js
- component/
- assets/
- image.png
- assets/
- some-library-needing-special-treatment.js
- external/
- buffer.bin
dist/
- bundle.js
- allAssets/
- some-library-needing-special-treatment.js
- image.png
- buffer.bin
```
- `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