Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hunghg255/vite-host-qrcode
Run Vite host with qrcode
https://github.com/hunghg255/vite-host-qrcode
host npm plugins qrcode vite
Last synced: about 2 months ago
JSON representation
Run Vite host with qrcode
- Host: GitHub
- URL: https://github.com/hunghg255/vite-host-qrcode
- Owner: hunghg255
- License: mit
- Created: 2023-10-07T10:34:06.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-05-03T08:34:01.000Z (8 months ago)
- Last Synced: 2024-05-03T13:26:18.517Z (8 months ago)
- Topics: host, npm, plugins, qrcode, vite
- Language: TypeScript
- Homepage:
- Size: 129 KB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
A plugin print text, QR code for Vitejs## Install
```bash
npm i vite-host-qrcode -D
``````bash
# package.json
"scripts": {
"dev": "vite --host",
...
},
```Vite
```ts
// vite.config.ts
import HostQrCode from 'vite-host-qrcode/vite'export default defineConfig({
plugins: [
HostQrCode({ /* options */ }),
],
})
```Example: [`playground/`](./playground/)
## Options
```ts
type Message = string | MessageValue | ((kolorist: Kolorist) => string | MessageValue | Promise)export interface Options {
info?: Message[]
/**
* filter list of shown QR codes. Useful if you have multiple interfaces and only need one
*
* examples:
* url => url.startsWith('http://192.')
* url => !url.startsWith('http://172.)
* url => url === 'http://192.168.1.70:4173'
*
* @param url {string} ip address
* @returns {boolean}
*/
filter?: (url: string) => boolean
}
```### filter
A function that allows you to select addresses to show QR-Codes for in case you have multiple interfaces
Example:
```js
// vite.config.js
import HostQrCode from 'vite-host-qrcode/vite'export default defineConfig({
plugins: [HostQrCode({ filter: (url) => url === 'http://192.168.1.1:4173' })]
});
```