Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alloc/vite-plugin-rehost
Self-hosted resources from index.html
https://github.com/alloc/vite-plugin-rehost
vite vite-plugin
Last synced: 3 days ago
JSON representation
Self-hosted resources from index.html
- Host: GitHub
- URL: https://github.com/alloc/vite-plugin-rehost
- Owner: alloc
- License: mit
- Created: 2021-01-18T19:06:00.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-10-15T20:04:22.000Z (about 3 years ago)
- Last Synced: 2024-09-15T04:54:43.734Z (2 months ago)
- Topics: vite, vite-plugin
- Language: TypeScript
- Homepage:
- Size: 63.5 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vite-plugin-rehost
[![npm](https://img.shields.io/npm/v/vite-plugin-rehost.svg)](https://www.npmjs.com/package/vite-plugin-rehost)
[![Code style: Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://paypal.me/alecdotbiz)> Self-hosted resources from index.html
Any `` and `` elements that point to external URLs are fetched
at build time and saved to the `outDir` to be self-hosted. The resources will have a content
hash in their name, so [`Cache-Control: immutable`](https://www.keycdn.com/blog/cache-control-immutable) can be used.Within self-hosted `.css` files, any `url()` expressions that point to external URLs are also
fetched and saved to the `outDir` to be self-hosted.**Note:** This plugin depends on [#1675](https://github.com/vitejs/vite/pull/1675)
### Usage
```sh
yarn add vite-plugin-rehost -D
```Within your `vite.config.js` file:
```ts
import rehost from 'vite-plugin-rehost'export default {
plugins: [
rehost(),
]
}
```