https://github.com/oyjt/vite-plugin-clean-build
A vite plugin for remove/clean files after build.
https://github.com/oyjt/vite-plugin-clean-build
clean-files remove-files vite vite-plugin
Last synced: 4 months ago
JSON representation
A vite plugin for remove/clean files after build.
- Host: GitHub
- URL: https://github.com/oyjt/vite-plugin-clean-build
- Owner: oyjt
- License: mit
- Created: 2023-10-15T10:31:49.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-04-05T05:00:22.000Z (about 1 year ago)
- Last Synced: 2025-09-17T13:53:04.795Z (9 months ago)
- Topics: clean-files, remove-files, vite, vite-plugin
- Language: TypeScript
- Homepage:
- Size: 44.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vite-plugin-clean-build
 
A vite plugin for remove/clean files after build.
[English](README.md) | [中文](README_CN.md)
## Table of Contents
1. [Installation](#installation)
2. [Usage](#usage)
3. [Issues](#issues)
4. [License](#license)
### Installation
```bash
# npm
npm i vite-plugin-clean-build -D
# yarn
yarn add vite-plugin-clean-build -D
# pnpm
pnpm add vite-plugin-clean-build -D
```
### Usage
Here's an example vite config illustrating how to use this plugin
**vite.config.js**
```js
import CleanBuild from 'vite-plugin-clean-build';
export default {
plugins: [CleanBuild()],
}
```
Options
You can pass a hash of configuration options to `vite-plugin-clean-build`.
Allowed values are as follows:
|Name|Type|Default|Description|
|:--:|:--:|:-----:|:----------|
|**`outputDir`**|`{string}`|`'dist'`|Removes files in the directory|
|**`patterns`**|`{Array}`|`[]`|Removes files after every build that match this pattern|
|**`verbose`**|`{boolean}`|`false`|Write logs to console|
Here's an example vite config illustrating how to use these options
**vite.config.js**
```js
import CleanBuild from 'vite-plugin-clean-build';
export default {
plugins: [CleanBuild(
{
outputDir: 'dist',
patterns: [
'images/**',
'!images/logo.png'
],
verbose: true,
}
)],
}
```
### Issues
If you encounter some problems during use, please click here [Issue Report](https://github.com/oyjt/vite-plugin-clean-build/issues)
### License
[MIT License](https://github.com/oyjt/vite-plugin-clean-build/blob/master/LICENSE)
Copyright (c) 2023-present cnpath