#1 Add ./preview.sh --refresh to automatically rebuild documentation on its source change.
Merged 4 years ago by sgallagh. Opened 4 years ago by jkaluza.
fedora-ci/ jkaluza/eln-docs preview-refresh  into  master

file modified
+3
@@ -59,3 +59,6 @@ 

  ```

  

  The result will be available at http://localhost:8080

+ 

+ When using Linux, it is also possible to pass `--refresh` argument to automatically

+ rebuild the documentation on source change.

file modified
+23 -3
@@ -13,7 +13,27 @@ 

      echo ""

      echo "The preview is available at http://localhost:8080"

      echo ""

-     pushd ./public

-     python3 -m http.server 8080

-     popd

+ 

+     if [[ "$*" == *--refresh* ]]; then

+         if ! [ -x "$(command -v inotifywait)" ]; then

+             echo 'Error: inofitywait (inotify-utils) is not installed.' >&2

+             exit 1

+         fi

+ 

+         # Setup trap to kill this process group on ctrl+c.

+         killgroup(){

+             kill 0

+         }

+         trap killgroup SIGINT

+ 

+         # Run the Python's webserver.

+         python3 -m http.server 8080 --directory ./public &

+ 

+         while inotifywait -r ./modules -e create -e moved_to -e modify; do

+              echo "Documentation source changed, rebuilding ..."

+             ./build.sh

+         done

+     else

+         python3 -m http.server 8080 --directory ./public

+     fi

  fi

no initial comment

rebased onto 66515a1

4 years ago

I know it's not ideal, but it saves time when testing documentation I wrote, especially if I don't have lot of experience with the syntax and I need to rebuild the documentation frequently.

rebased onto aed5fe4

4 years ago

Pull-Request has been merged by sgallagh

4 years ago
Metadata