#!/usr/bin/env bash

# Clone doc-template repo only if 'docbuild' directory doesn't exist
[ -d docbuild ] || (git clone https://github.com/prest/doc-template docbuild)

# Update local template repo and build documentation
cd docbuild && \
    git fetch && \
    git pull --force && \
    rm -rf content && \
    cp -rf ../docs content && \
    rm -rf static/content && \
    mv content/assets static/content && \
    hugo "$@"


#!/usr/bin/env bash

rm -rf docbuild && \
    git clone https://github.com/prest/doc-template docbuild && \
    rm -rf docbuild/content && \
    cp -rf docs docbuild/content && \
    mv docbuild/content/assets docbuild/static/content && \
    cd docbuild && \
    hugo "$@"


--- 
+++ 
@@ -1,15 +1,10 @@
 #!/usr/bin/env bash
 
-# Clone doc-template repo only if 'docbuild' directory doesn't exist
-[ -d docbuild ] || (git clone https://github.com/prest/doc-template docbuild)
-
-# Update local template repo and build documentation
-cd docbuild && \
-    git fetch && \
-    git pull --force && \
-    rm -rf content && \
-    cp -rf ../docs content && \
-    rm -rf static/content && \
-    mv content/assets static/content && \
+rm -rf docbuild && \
+    git clone https://github.com/prest/doc-template docbuild && \
+    rm -rf docbuild/content && \
+    cp -rf docs docbuild/content && \
+    mv docbuild/content/assets docbuild/static/content && \
+    cd docbuild && \
     hugo "$@"
 
Improve performance of documentation building checking if the `docbuild`
directory already exists and just update it before.

Signed-off-by: Fabrízio de Royes Mello <b43aa4da7d49446458a27682d03373956825fb53@gmail.com>
