Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/saadeghi/vite-and-run
Starts a Vite server and runs a custom command when files are changed and triggers a hot reload
https://github.com/saadeghi/vite-and-run
http-server npx vite vite-plugin vitejs
Last synced: 19 days ago
JSON representation
Starts a Vite server and runs a custom command when files are changed and triggers a hot reload
- Host: GitHub
- URL: https://github.com/saadeghi/vite-and-run
- Owner: saadeghi
- License: mit
- Created: 2023-10-14T07:09:57.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2023-10-17T05:11:24.000Z (about 1 year ago)
- Last Synced: 2024-10-11T12:48:24.020Z (about 1 month ago)
- Topics: http-server, npx, vite, vite-plugin, vitejs
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/vite-and-run
- Size: 14.6 KB
- Stars: 12
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vite-and-run
`npx vite-and-run "your_command"` starts a Vite server and runs a custom command when files are changed and triggers a hot reload.
## What is it?
It's just a wrapper around [Vite](https://vitejs.dev/) + [vite-plugin-watch-and-run](https://www.npmjs.com/package/vite-plugin-watch-and-run) together.
But it's easier to use a single `npx` command than to install and configure everything.## How to use
### Example 1
```
npx vite-and-run "echo Hello"
```- Starts a Vite server in current directory
- Runs `echo Hello` command when any file in current directory is changed.
- Triggers a hot reload in the browser.### Example 2
```
npx vite-and-run "tailwindcss -o output.css" "index.html"
```- Starts a Vite server in current directory
- Runs `tailwindcss -o output.css` command when `index.html` is changed.
- Triggers a hot reload in the browser.### Example 3
```
npx vite-and-run "node start.js" "src/*.jpg" 1000
```- Starts a Vite server in current directory
- Runs `node start.js` command when `src/*.jpg` files are changed with a `1000` milliseconds delay. Delay is useful when you make changes to multiple files at once and you want to prevent multiple executions of the command.
- Triggers a hot reload in the browser.