Serve a local static website during development so browser security restrictions do not block file fetches, with instant reload on every save.
Configure a fallback page for a single-page app so refreshing deep URLs does not return a 404 during local testing.
Use as a Node.js module inside a build script to programmatically start and stop the dev server as part of an automated workflow.
Requires Node.js, one npm install -g live-server command is all you need.
Live Server is a small development tool that runs a local web server on your computer and automatically refreshes your browser whenever you save a file. It is aimed at people building websites or web apps who want to see their changes instantly without manually hitting the reload button each time. The main reason to use it is that web browsers block certain features, like fetching data from other files, when you open an HTML page directly from your file system. Running a local server sidesteps that restriction. The live-reload feature adds convenience on top: when you change a JavaScript or HTML file the page reloads, and when you change a CSS file the new styles are applied immediately without even a full reload. Setup requires Node.js to be installed, then a single command installs the tool: npm install -g live-server. After that, you type live-server inside your project folder and it opens the browser for you. There are no browser plugins to install. The tool works by injecting a tiny script into each HTML page it serves, that script opens a connection back to the server and listens for reload instructions. The command line accepts a range of options. You can change the port, restrict which files are watched for changes, ignore certain folders, serve a fallback page for single-page apps, enable password protection, set up HTTPS, or proxy certain URL paths to another server. The same options are available when you use the tool as a Node.js module inside your own code, passing them as a plain JavaScript object. It is intended for development only, not for running a production website. The project notes it is best suited for hacking on HTML, JavaScript, and CSS files during the building phase.
← tapio on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.