Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dockerfiles/Dockerfile.bootstrap2
-rwxr-xr-xscripts/minify-assets.sh25
2 files changed, 22 insertions, 5 deletions
diff --git a/dockerfiles/Dockerfile.bootstrap b/dockerfiles/Dockerfile.bootstrap
index d65697b0..9dfdd857 100644
--- a/dockerfiles/Dockerfile.bootstrap
+++ b/dockerfiles/Dockerfile.bootstrap
@@ -28,7 +28,7 @@ RUN yarn install
# Copy scripts used for static HTML post-processing
COPY scripts /scripts/
-COPY --from=minifier /minify /scripts/minify
+COPY --from=minifier /minify /usr/local/bin/minify
MAINTAINER GitLab Documentation Team
diff --git a/scripts/minify-assets.sh b/scripts/minify-assets.sh
index a0b5bfb7..7da94bf9 100755
--- a/scripts/minify-assets.sh
+++ b/scripts/minify-assets.sh
@@ -15,12 +15,29 @@ if ! [ -d "$TARGET" ]; then
exit 1
fi
+# Check if minify is in the PATH
+which minify > /dev/null 2>&1
+# Check if the previous command has a 0 exit status
+if [ $? -eq 0 ]
+then
+ MINIFY_BIN=$(which minify)
+else
+ # Backwards compatibility
+ if [ -f /scripts/minify ]
+ then
+ MINIFY_BIN=/scripts/minify
+ else
+ echo "minify binary not found in PATH. Exiting."
+ exit 1
+ fi
+fi
+
# Minify assets
printf "Optimizing assets..."
-printf "HTML..."; /scripts/minify $MINIFY_FLAGS --type=html --match=\.html -o ${TARGET}/${VER}/ ${TARGET}/${VER} || true
-printf "CSS..." ; /scripts/minify $MINIFY_FLAGS --type=css --match=\.css -o ${TARGET}/${VER}/ ${TARGET}/${VER} || true
-printf "JSON..."; /scripts/minify $MINIFY_FLAGS --type=json --match=\.json -o ${TARGET}/${VER}/ ${TARGET}/${VER} || true
-printf "SVG..." ; /scripts/minify $MINIFY_FLAGS --type=svg --match=\.svg -o ${TARGET}/${VER}/ ${TARGET}/${VER} || true
+printf "HTML..."; $MINIFY_BIN $MINIFY_FLAGS --type=html --match=\.html -o ${TARGET}/${VER}/ ${TARGET}/${VER} || true
+printf "CSS..." ; $MINIFY_BIN $MINIFY_FLAGS --type=css --match=\.css -o ${TARGET}/${VER}/ ${TARGET}/${VER} || true
+printf "JSON..."; $MINIFY_BIN $MINIFY_FLAGS --type=json --match=\.json -o ${TARGET}/${VER}/ ${TARGET}/${VER} || true
+printf "SVG..." ; $MINIFY_BIN $MINIFY_FLAGS --type=svg --match=\.svg -o ${TARGET}/${VER}/ ${TARGET}/${VER} || true
echo "Done"