From e4af8fa84a0b1ec39487aa3d31139ee542d01b66 Mon Sep 17 00:00:00 2001 From: Florian Gnaegi - frentix GmbH <gnaegi@frentix.com> Date: Wed, 20 Nov 2013 16:54:33 +0100 Subject: [PATCH] OO-871 improve compile script to compile multiple themes in one step --- src/main/webapp/static/themes/compiletheme.sh | 44 ++++++++++++++----- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/src/main/webapp/static/themes/compiletheme.sh b/src/main/webapp/static/themes/compiletheme.sh index 7dea436a886..c6c5164f862 100755 --- a/src/main/webapp/static/themes/compiletheme.sh +++ b/src/main/webapp/static/themes/compiletheme.sh @@ -7,21 +7,43 @@ # In the case it does not compile all files, it's helpful to delete the sass-cache (rm -r .sass-cache). # # usage: -# ./compiletheme.sh # compile themes in the current directory -# ./compiletheme.sh /path/to/your/custom/theme # compile themes in the given directory +# ./compiletheme.sh # compile themes in the current directory +# ./compiletheme.sh /path/to/your/custom/theme # compile themes in the given directory +# ./compiletheme.sh /path/to/your/custom/themedir # compile all themes in the given directory # #### -style=compressed -#style=compact +# Configuration +STYLE=compressed +#STYLE=compact -# default to compile the themes in the current directory -directory="." -if [ ! -z $1 ]; then directory=$1; fi +# Helper method to add theme to array +searchThemes () { + if [ ! -z $1 ]; + then + if [ -f $1/layout.scss ]; + then + doCompile $1 + elif [ -d $1 ]; + then + for FILE in $1/* + do + searchThemes $FILE + done + fi + fi +} -echo "Compiling SASS: $directory $style" -sass --version +# Helper method to compile the theme +doCompile () { + echo "Compiling SASS: $1 $STYLE" + sass --version + sass --style $STYLE --update $1:$1 --load-path openolat openolat/all openolat/all/modules openolat/print openolat/mobile + echo "done" +} -sass --style $style --update $directory:$directory --load-path openolat openolat/all openolat/all/modules openolat/print openolat/mobile -echo "done" \ No newline at end of file +# Add themes to compile from given path +doCompile "."; +searchThemes $1; +echo "DONE" -- GitLab