Tiny live-reloading HTTP server. Alternative to live-server and browser-sync without all of the features/dependencies.
Reloads the page after any changes in the served directory, through a snippet of code injected into all served HTML files.
# start a server in the current dir
serve
# start a server in a specific dir
serve ./dist
# run directly from npm
npx @danprince/serve ./dist
import { createLiveReloadServer } from "@danprince/serve";
createLiveReloadServer({
dir: "./dist",
port: 8080,
});
See src/cli.ts
for a more comprehensive example.