LiveReloadServer 1.3.1

dotnet tool install --global LiveReloadServer --version 1.3.1
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest # if you are setting up this repo
dotnet tool install --local LiveReloadServer --version 1.3.1
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=LiveReloadServer&version=1.3.1
nuke :add-package LiveReloadServer --version 1.3.1

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 7, 6 or 5 SDK
  • Hosted: .NET 7
  • Standalone Exe (Window): self-contained (.NET 7)
  • If optionally hosting requires a Web Server that supports WebSockets

You can grab the compiled tool as:

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 uses LiveReloadServer.

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 substitute LiveReloadServer with LiveReloadWebServer 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last updated
1.3.1 734 11/19/2023
1.2.4 551 9/12/2023
1.2.3 535 7/2/2023
1.2.2 651 4/7/2023
1.2.1 557 2/14/2023
1.2.0 433 1/29/2023
1.1.7 789 10/17/2022
1.1.5.1 1,497 3/27/2022
1.1.2 825 1/17/2022
1.1.0 613 11/11/2021
1.0.8 449 11/11/2021
1.0.6 476 11/2/2021
1.0.5 671 9/5/2021
1.0.3 2,601 5/9/2021
1.0.2 570 4/2/2021
1.0.0 729 3/13/2021
0.2.23 626 1/18/2021
0.2.22 517 1/3/2021
0.2.20 726 11/12/2020
0.2.16 541 10/29/2020
0.2.15 553 10/22/2020
0.2.12 595 10/5/2020
0.2.6 787 7/13/2020
0.2.4 672 6/27/2020
0.2.3 652 6/12/2020
0.2.2 643 5/1/2020
0.2.1 588 4/27/2020
0.1.20 571 4/15/2020
0.1.19 585 4/13/2020
0.1.18 610 4/6/2020
0.1.13 846 11/13/2019
0.1.12.1 583 11/12/2019
0.1.12 608 11/5/2019
0.1.10 558 11/2/2019
0.1.9 570 10/30/2019
0.1.8 601 10/12/2019
0.1.7 640 9/27/2019
0.1.5 525 9/27/2019
0.1.3 582 9/23/2019
0.1.1 561 9/22/2019
0.1.0 601 9/22/2019