From 01092f4c152cf95767e80c62afd4af4425c1555f Mon Sep 17 00:00:00 2001 From: Fredrik Ekre Date: Wed, 12 Oct 2022 17:36:05 +0200 Subject: [PATCH] Update LiveServer.jl configuration. --- docs/Makefile | 11 ++++------- docs/liveserver.jl | 24 ++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 7 deletions(-) create mode 100755 docs/liveserver.jl diff --git a/docs/Makefile b/docs/Makefile index 8dd5797..b44d74b 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -1,11 +1,8 @@ SRCDIR:=$(shell dirname $(abspath $(firstword $(MAKEFILE_LIST)))) -default: livedocs +default: liveserver -instantiate: - julia --project=${SRCDIR} -e 'using Pkg; Pkg.instantiate()' +liveserver: + julia --project=${SRCDIR} ${SRCDIR}/liveserver.jl -livedocs: instantiate - julia --project=${SRCDIR} -e 'using LiveServer; LiveServer.servedocs(; foldername=pwd())' -- liveserver - -.PHONY: default instantiate livedocs +.PHONY: default liveserver diff --git a/docs/liveserver.jl b/docs/liveserver.jl new file mode 100755 index 0000000..7d9c6fa --- /dev/null +++ b/docs/liveserver.jl @@ -0,0 +1,24 @@ +#!/usr/bin/env julia + +# Root of the repository +const repo_root = dirname(@__DIR__) + +# Make sure docs environment is active and instantiated +import Pkg +Pkg.activate(@__DIR__) +Pkg.instantiate() + +# Communicate with docs/make.jl that we are running in live mode +push!(ARGS, "liveserver") + +# Run LiveServer.servedocs(...) +import LiveServer +LiveServer.servedocs(; + # Documentation root where make.jl and src/ are located + foldername = joinpath(repo_root, "docs"), + # Extra source folder to watch for changes + include_dirs = [ + # Watch the src folder so docstrings can be Revise'd + joinpath(repo_root, "src"), + ], +)