LiveReloadServer 1.4.0
dotnet tool install --global LiveReloadServer --version 1.4.0
dotnet new tool-manifest # if you are setting up this repo dotnet tool install --local LiveReloadServer --version 1.4.0
#tool dotnet:?package=LiveReloadServer&version=1.4.0
nuke :add-package LiveReloadServer --version 1.4.0
Live Reload Web Server
A self-contained, local, cross-platform, static file Web Server with automatic Live Reloading, Markdown rendering and loose Razor Pages support.
This server supports:
Generic Static File Web Server you can launch in any folder
Just start with:
LiveReloadServer <folder>
(dotnet tool)LiveReloadWebServer <folder>
(installed version)
LiveReload functionality for change detection and browser refresh
Self-contained Razor Pages support with Live Reload Support
Themed Markdown page rendering support built in
Options to customize location, port, files checked etc.
Easily installed and updated with
dotnet tool -g install LiveReloadServer
Run local SPA applications (Angular, VueJs, React etc.)
Run Blazor Applications (without Live Reload support however)
Cross Platform - Windows, Mac, Linux (dotnet tool only)
Serve HTTPS content (dotnet tool only)
Hostable ASP.NET Core app that can be used by multiple sites on a server
Available as: Dotnet Tool, Chocolatey Package, or Self-Contained (Windows) Download
Requirements:
- Dotnet Tool: .NET 8 SDK
- Hosted: .NET 8 (Asp.Net Runtime)
- Standalone Exe (Windows): self-contained (.NET 8)
- If optionally hosting requires a Web Server that supports WebSockets
- Older versions of .NET are supported with prior releases
- < 1.3 - .NET 7.0
- ⇐ 1.1 - .NET 6.0
You can grab the compiled tool as:
- Dotnet Tool <small>(windows, mac, linux)</small>
dotnet tool install -g LiveReloadServer
- Chocolatey Package <small>(windows)</small>
choco install LiveReloadWebServer
- Self Contained Windows Executable Folder (zipped) <small>(windows)</small>
- Hostable Package (requires installed .NET 7.0 Runtime) <small>(windows, mac, linux)</small>
All three versions have the same features and interface, just the delivery mechanism and the executable name is different. The EXE uses
LiveReloadWebServer
while the Dotnet Tool usesLiveReloadServer
.
What does it do?
This tool is a generic local Web Server that you can point to any folder and provide simple and quick HTTP access to HTML and other Web resources. You can serve any static resources - HTML, CSS, JS etc. - as well as loose Razor Pages that don't require any code behind or dependent source code. There's also optional support for rendering Markdown Pages as themed HTML directly from Markdown files.
Live Reload is enabled by default and checks for changes to common static files. If a checked file is changed, the browser's current page is refreshed. You can map additional extensions that trigger the LiveReload.
You can also use this 'generic' server behind a live Web Server (like IIS, nginx etc.) by installing the main project as a deployed Web application to provide loose Razor support and Markdown rendering on a Web server. A single LiveReloadServer installation can serve many Web sites using the same static, Razor and Markdown resources which can be ideal for mostly static content sites that need 'a little extra' beyond plain static pages (examples here and here).
Installation
You can install this server as a .NET Tool using Dotnet SDK Tool installation:
dotnet tool install -g LiveReloadServer
To use it, navigate to a folder that you want to serve HTTP files out of:
# will serve current folder files out of http://localhost:5200
LiveReloadServer
# specify a folder instead of current folder and a different port
LiveReloadServer "c:/temp/My Local WebSite" --port 5350 -UseSsl
# Customize some options
LiveReloadServer --LiveReloadEnabled False --OpenBrowser False -UseSsl -UseRazor
You can also install from Chocolatey:
choco install LiveReloadWebServer
Note that EXE filename is LiveReloadWebServer
which is different from the Dotnet Tool's LiveReloadServer
so they can exist side by side without conflict.
Any of the following examples use
LiveReloadServer
, and you should substituteLiveReloadServer
withLiveReloadWebServer
for any non dotnet tool installations.
Launching the Web Server
You can use the command line to customize how the server runs. By default files are served out of the current directory on port 5200
, but you can override the WebRoot
folder.
Use commandline parameters to customize:
LiveReloadServer "c:/temp/My Web Site" --port 5200 -useSsl -openEditor
There are a number of Configuration options available:
Syntax:
-------
LiveReloadServer <path> <options>
--WebRoot <path> (current Path if not provided)
--Port 5200*
--Host 0.0.0.0*|localhost|custom Ip - 0.0.0.0 allows external access
--UseSsl True|False*
--UseRazor True|False*
--UseLiveReload True*|False
--Extensions ".cshtml,.css,.js,.htm,.html,.ts"*
--DefaultFiles "index.html,default.htm"*
--ShowUrls True|False*
--OpenBrowser True*|False
--BrowserUrl optional startup url (site relative or absolute)
--OpenEditor True|False*
--EditorLaunchCommand "code \"%1\""* (Win) or
"open -a \"Visual Studio Code\" \"%1\""* (Mac)
--DetailedErrors True*|False
--Environment Production*|Development
Razor Pages:
------------
--UseRazor True|False*
Markdown Options:
-----------------
--UseMarkdown True|False*
--CopyMarkdownResources True|False*
--MarkdownTemplate ~/markdown-themes/__MarkdownTestmplatePage.cshtml*
--MarkdownTheme github*|dharkan|medium|blackout|westwind
--MarkdownSyntaxTheme github*|vs2015|vs|monokai|monokai-sublime|twilight
Configuration options can be specified in:
* Command Line options as shown above
* Logical Command Line Flags for true can be set like: -UseSsl or -UseRazor or -OpenBrowser
* Environment Variables with 'LIVERELOADSERVER_' prefix. Example: 'LIVERELOADSERVER_PORT'
Examples:
---------
LiveReloadServer --WebRoot "c:\temp\My Site" --port 5500 -useSsl -useRazor --openBrowser false
$env:LiveReloadServer_Port 5500
$env:LiveReloadServer_WebRoot c:\mySites\Site1\Web
LiveReloadServer
You can also use Environment variables to set these save options by using a LiveReloadServer_
prefix:
$env:LiveReloadServer_Port 5500
LiveReload
For more info please go to the GitHub documentation:
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
This package has no dependencies.
Version | Downloads | Last updated |
---|---|---|
1.4.0 | 698 | 5/23/2024 |
1.3.1 | 927 | 11/19/2023 |
1.2.4 | 600 | 9/12/2023 |
1.2.3 | 560 | 7/2/2023 |
1.2.2 | 682 | 4/7/2023 |
1.2.1 | 585 | 2/14/2023 |
1.2.0 | 463 | 1/29/2023 |
1.1.7 | 813 | 10/17/2022 |
1.1.5.1 | 1,518 | 3/27/2022 |
1.1.2 | 851 | 1/17/2022 |
1.1.0 | 635 | 11/11/2021 |
1.0.8 | 470 | 11/11/2021 |
1.0.6 | 502 | 11/2/2021 |
1.0.5 | 691 | 9/5/2021 |
1.0.3 | 2,624 | 5/9/2021 |
1.0.2 | 583 | 4/2/2021 |
1.0.0 | 750 | 3/13/2021 |
0.2.23 | 646 | 1/18/2021 |
0.2.22 | 537 | 1/3/2021 |
0.2.20 | 753 | 11/12/2020 |
0.2.16 | 564 | 10/29/2020 |
0.2.15 | 572 | 10/22/2020 |
0.2.12 | 617 | 10/5/2020 |
0.2.6 | 813 | 7/13/2020 |
0.2.4 | 695 | 6/27/2020 |
0.2.3 | 680 | 6/12/2020 |
0.2.2 | 667 | 5/1/2020 |
0.2.1 | 608 | 4/27/2020 |
0.1.20 | 589 | 4/15/2020 |
0.1.19 | 605 | 4/13/2020 |
0.1.18 | 628 | 4/6/2020 |
0.1.13 | 871 | 11/13/2019 |
0.1.12.1 | 601 | 11/12/2019 |
0.1.12 | 628 | 11/5/2019 |
0.1.10 | 578 | 11/2/2019 |
0.1.9 | 590 | 10/30/2019 |
0.1.8 | 626 | 10/12/2019 |
0.1.7 | 659 | 9/27/2019 |
0.1.5 | 548 | 9/27/2019 |
0.1.3 | 599 | 9/23/2019 |
0.1.1 | 582 | 9/22/2019 |
0.1.0 | 637 | 9/22/2019 |