Skip to content

Simple development server with live-reload capability for Julia.

License

Notifications You must be signed in to change notification settings

fredrikekre/LiveServer.jl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Live Server for Julia

Status (Linux/Mac) Status (Windows) Coverage Docs
Build Status AppVeyor codecov.io stable-doc dev-doc

This is a simple and lightweight development web-server written in Julia, based on HTTP.jl. It has live-reload capability, i.e. when modifying a file, every browser (tab) currently displaying the corresponding page is automatically refreshed.

LiveServer is inspired from Python's http.server and Node's browsersync.

Installation

To install it in Julia ≥ 1.0, use the package manager with

pkg> add LiveServer

Usage

The main function LiveServer exports is serve which starts listening to the current folder and makes its content available to a browser. The following code creates an example directory and serves it:

julia> using LiveServer
julia> LiveServer.example() # creates an "example/" folder with some files
julia> cd("example")
julia> serve() # starts the local server & the file watching
✓ LiveServer listening on http://localhost:8000/ ...
  (use CTRL+C to shut down)

Open a Browser and go to http://localhost:8000/ to see the content being rendered; try modifying files (e.g. index.html) and watch the changes being rendered immediately in the browser.

Serve docs

A derived function from serve that will be convenient to Julia package developpers is servedocs which runs Documenter along with LiveServer to render your docs and will track and render any modifications to your docs. This can make docs development significantly easier.

Assuming you are in directory/to/YourPackage.jl and that you have a docs/ folder as prescribed by Documenter.jl, just run:

julia> using YourPackage, LiveServer
julia> servedocs()
[ Info: SetupBuildDirectory: setting up build directory.
[ Info: ExpandTemplates: expanding markdown templates.
...
└ Deploying: ✘
✓ LiveServer listening on http://localhost:8000/ ...
  (use CTRL+C to shut down)

Open a browser and go to http://localhost:8000/ to see your docs being rendered; try modifying files (e.g. docs/index.md) and watch the changes being rendered in the browser.

About

Simple development server with live-reload capability for Julia.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Julia 98.1%
  • HTML 1.8%
  • CSS 0.1%