Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bengsfort/rollup-plugin-copy-assets
Copy additional assets into the output directory of your rollup bundle.
https://github.com/bengsfort/rollup-plugin-copy-assets
assets rollup-plugin
Last synced: about 2 months ago
JSON representation
Copy additional assets into the output directory of your rollup bundle.
- Host: GitHub
- URL: https://github.com/bengsfort/rollup-plugin-copy-assets
- Owner: bengsfort
- License: mit
- Created: 2018-03-22T10:34:47.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-03T21:36:34.000Z (about 2 years ago)
- Last Synced: 2024-03-15T04:22:27.850Z (10 months ago)
- Topics: assets, rollup-plugin
- Language: JavaScript
- Size: 2 MB
- Stars: 23
- Watchers: 4
- Forks: 7
- Open Issues: 18
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome - copy-assets - Copy specified assets to the output directory. (Plugins / Output)
README
# rollup-plugin-copy-assets
![build status](https://api.travis-ci.org/bengsfort/rollup-plugin-copy-assets.svg?branch=master) ![coverage](coverage/coverage.svg) [![npm version](https://badge.fury.io/js/rollup-plugin-copy-assets.svg)](https://www.npmjs.com/package/rollup-plugin-copy-assets)
Copy additional assets into the output directory of your rollup bundle.
## Installation
```shell
# add with yarn
yarn add --dev rollup-plugin-copy-assets# or npm
npm install --save-dev rollup-plugin-copy-assets
```## Usage
```js
// rollup.config.js
import copy from "rollup-plugin-copy-assets";export default {
input: "src/index.js",
output: {
file: "dist/bundle.js",
format: "cjs",
},
plugins: [
copy({
assets: [
// You can include directories
"src/assets",
// You can also include files
"src/external/buffer.bin",
],
}),
],
};
```On final bundle generation the provided files will be copied over into the output folder of your rollup bundle, maintaining the original hierarchy and relativity to the input file:
```bash
# Source directory structure
src/
- index.js
- assets/
- some-library-needing-special-treatment.js
- external/
- buffer.bin# Output directory structure
dist/
- bundle.js
- assets/
- some-library-needing-special-treatment.js
- external/
- buffer.bin
```### Options
- `assets`: **(required)** An array of paths to copy. Accepts files as well as directories.
## License
MIT