-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
π chore(package.json): update package version to 0.1.7
β¨ feat(readme.md): add documentation for custom provider and license information
- Loading branch information
Showing
2 changed files
with
71 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,71 @@ | ||
# Vite CDN Uploader Plugin | ||
# Vite CDN Uploader Plugin π | ||
|
||
In development, I will update soon. | ||
The Vite CDN Uploader Plugin is a handy utility to automatically upload build files from Vite projects to various CDN providers. It currently supports Amazon S3 and Custom Providers. | ||
|
||
## Installation π» | ||
|
||
Install the plugin via npm or yarn: | ||
|
||
```bash | ||
npm install --save-dev vite-cdn-uploader | ||
``` | ||
|
||
or | ||
|
||
```bash | ||
yarn add -D vite-cdn-uploader | ||
``` | ||
|
||
## Usage π | ||
|
||
First, import the plugin in your Vite configuration file: | ||
|
||
```javascript | ||
import { cdnUploaderPlugin, providers } from "vite-cdn-uploader" | ||
``` | ||
|
||
Then, add the plugin to the `plugins` array in your Vite configuration: | ||
|
||
```javascript | ||
export default { | ||
plugins: [ | ||
cdnUploaderPlugin({ | ||
provider: new providers.AwsS3Provider(), | ||
}), | ||
], | ||
}; | ||
``` | ||
|
||
### Custom Provider π | ||
|
||
Create a custom provider by defining a class with a `config` method and an `upload` method: | ||
|
||
```javascript | ||
class CustomProvider { | ||
config() { | ||
// Provider Configs | ||
return {}; | ||
} | ||
async upload(file, filePath) { | ||
// Upload Process | ||
} | ||
} | ||
``` | ||
|
||
### Vite Configuration π | ||
|
||
Include your custom provider in your Vite configuration: | ||
|
||
```javascript | ||
export default { | ||
plugins: [ | ||
cdnUploaderPlugin({ | ||
provider: new CustomProvider(), | ||
}), | ||
], | ||
}; | ||
``` | ||
|
||
## License π | ||
|
||
MIT |