Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vladshcherbin/rollup-plugin-delete
Delete files and folders using Rollup
https://github.com/vladshcherbin/rollup-plugin-delete
clean clear delete directory file folder remove rollup rollup-plugin
Last synced: 27 days ago
JSON representation
Delete files and folders using Rollup
- Host: GitHub
- URL: https://github.com/vladshcherbin/rollup-plugin-delete
- Owner: vladshcherbin
- Created: 2018-07-02T08:28:15.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-12-06T17:50:29.000Z (about 4 years ago)
- Last Synced: 2024-05-01T01:21:28.360Z (8 months ago)
- Topics: clean, clear, delete, directory, file, folder, remove, rollup, rollup-plugin
- Language: JavaScript
- Size: 351 KB
- Stars: 64
- Watchers: 2
- Forks: 3
- Open Issues: 5
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
- awesome - delete - Delete files and folders during a build. (Plugins / Output)
README
# rollup-plugin-delete
Delete files and folders using Rollup.
## About
This plugin is useful when you want to clean `dist` or other folders and files before bundling. It's using [del package](https://github.com/sindresorhus/del) inside, check it for pattern examples.
## Installation
```bash
# yarn
yarn add rollup-plugin-delete -D# npm
npm install rollup-plugin-delete -D
```## Usage
```js
// rollup.config.js
import del from 'rollup-plugin-delete'export default {
input: 'src/index.js',
output: {
file: 'dist/app.js',
format: 'cjs'
},
plugins: [
del({ targets: 'dist/*' })
]
}
```### Configuration
There are some useful options:
#### targets
A string or an array of patterns of files and folders to be deleted. Default is `[]`.
```js
del({
targets: 'dist/*'
})del({
targets: ['dist/*', 'build/*']
})
```#### verbose
Output removed files and folders to console. Default is `false`.
```js
del({
targets: 'dist/*',
verbose: true
})
```> Note: use \* (wildcard character) in pattern to show removed files
#### hook
[Rollup hook](https://rollupjs.org/guide/en/#build-hooks) the plugin should use. Default is `buildStart`.
```js
del({
targets: 'dist/*',
hook: 'buildEnd'
})
```#### runOnce
Type: `boolean` | Default: `false`
Delete items once. Useful in watch mode.
```js
del({
targets: 'dist/*',
runOnce: true
})
```All other options are passed to [del package](https://github.com/sindresorhus/del) which is used inside.
## License
MIT