https://github.com/mentaljam/rollup-plugin-copy2
Rollup plugin to copy additional assets to the build directory.
https://github.com/mentaljam/rollup-plugin-copy2
Last synced: 12 months ago
JSON representation
Rollup plugin to copy additional assets to the build directory.
- Host: GitHub
- URL: https://github.com/mentaljam/rollup-plugin-copy2
- Owner: mentaljam
- License: mit
- Created: 2019-03-07T12:40:21.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2024-09-23T23:02:02.000Z (over 1 year ago)
- Last Synced: 2025-05-24T17:18:33.986Z (about 1 year ago)
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/rollup-plugin-copy2
- Size: 53.7 KB
- Stars: 3
- Watchers: 1
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rollup-plugin-copy2
[Rollup](https://github.com/rollup/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](https://github.com/mentaljam/rollup-plugin-zip)).
The actual copying is made by the Rollup itself.
## Install
```sh
npm i -D rollup-plugin-copy2
```
## Usage
```js
// 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
```js
(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](https://github.com/isaacs/node-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
```js
boolean?
```
Do not emit files with Rollup. Use this option with [outputDirectory](#outputDirectory)
if you only want to copy files to a specific directory.
### outputDirectory
#### Type
```js
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](LICENSE) © [Petr Tsymbarovich](mailto:petr@tsymbarovich.ru)