LiveReloadServer 1.5.0

dotnet tool install --global LiveReloadServer --version 1.5.0                
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.5.0                
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=LiveReloadServer&version=1.5.0                
nuke :add-package LiveReloadServer --version 1.5.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

  • More detailed info on Github

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:

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 net9.0 is compatible. 
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.5.0 94 12/16/2024
1.4.0 812 5/23/2024
1.3.1 936 11/19/2023
1.2.4 609 9/12/2023
1.2.3 566 7/2/2023
1.2.2 688 4/7/2023
1.2.1 591 2/14/2023
1.2.0 469 1/29/2023
1.1.7 819 10/17/2022
1.1.5.1 1,527 3/27/2022
1.1.2 860 1/17/2022
1.1.0 644 11/11/2021
1.0.8 481 11/11/2021
1.0.6 511 11/2/2021
1.0.5 700 9/5/2021
1.0.3 2,633 5/9/2021
1.0.2 592 4/2/2021
1.0.0 759 3/13/2021
0.2.23 655 1/18/2021
0.2.22 546 1/3/2021
0.2.20 762 11/12/2020
0.2.16 573 10/29/2020
0.2.15 581 10/22/2020
0.2.12 626 10/5/2020
0.2.6 825 7/13/2020
0.2.4 704 6/27/2020
0.2.3 689 6/12/2020
0.2.2 676 5/1/2020
0.2.1 617 4/27/2020
0.1.20 598 4/15/2020
0.1.19 614 4/13/2020
0.1.18 637 4/6/2020
0.1.13 880 11/13/2019
0.1.12.1 611 11/12/2019
0.1.12 637 11/5/2019
0.1.10 587 11/2/2019
0.1.9 599 10/30/2019
0.1.8 635 10/12/2019
0.1.7 669 9/27/2019
0.1.5 555 9/27/2019
0.1.3 611 9/23/2019
0.1.1 594 9/22/2019
0.1.0 649 9/22/2019