Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/akshaybabloo/vite-plugin-file-rename
Post-build plugin for Vite to rename files
https://github.com/akshaybabloo/vite-plugin-file-rename
vite vite-plugin
Last synced: 10 days ago
JSON representation
Post-build plugin for Vite to rename files
- Host: GitHub
- URL: https://github.com/akshaybabloo/vite-plugin-file-rename
- Owner: akshaybabloo
- License: mit
- Created: 2023-11-09T20:27:25.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-28T18:51:58.000Z (18 days ago)
- Last Synced: 2024-10-28T19:48:40.858Z (18 days ago)
- Topics: vite, vite-plugin
- Language: TypeScript
- Homepage:
- Size: 135 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Vite File Rename Plugin
Post-build plugin for Vite to rename files.
## Install
```bash
npm i -D vite-plugin-file-rename
```## Usage
```js
// vite.config.mts
import { defineConfig } from 'vite'
import { fileRename } from 'vite-plugin-file-rename'export default defineConfig({
plugins: [
fileRename({
fileMap: {
'index.html': 'index.php',
'index.css': 'index.min.css',
'index.js': 'index.min.js',
'.json': '.jsonp',
},
}),
],
})
```## Options
### `fileMap`
Type: `Record`
Default: `{}`
Required: `true`A map of files to rename. The key is the original file name, and the value is the new file name.
### `keepOriginal`
Type: `boolean`
Default: `false`
Required: `false`Whether to keep the original file. If `true`, the original file will be kept and a new file will be created with the new name. If `false`, the original file will be deleted and a new file will be created with the new name.
### `useRegex`
Type: `boolean`
Default: `false`
Required: `false`Whether to use regex to match the file name. If `true`, the key in `fileMap` will be treated as a regex string. If `false`, the key in `fileMap` will be treated as a normal string.