0.2.4 • Published 1 year ago

vite-cdn-uploader v0.2.4

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Vite CDN Uploader Plugin 🚀

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:

npm install --save-dev vite-cdn-uploader

or

yarn add -D vite-cdn-uploader

Usage 🛠

First, import the plugin in your Vite configuration file:

import { cdnUploaderPlugin, providers } from "vite-cdn-uploader"

If your project does not have an .env file yet:

touch .env

Then, add the following content to your .env file:

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=
AWS_BUCKET=

Then, add the plugin to the plugins array in your Vite configuration:

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:

class CustomProvider {
    config() {
        // Provider Configs
        return {};
    }
    async upload(file, filePath) {
        // Upload Process
    }
}

Vite Configuration 📝

Include your custom provider in your Vite configuration:

export default {
  plugins: [
    cdnUploaderPlugin({
      provider: new CustomProvider(),
    }),
  ],
};

License 📄

MIT

0.2.4

1 year ago

0.2.3

1 year ago

0.2.2

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.9

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago