mirror of
https://github.com/goharbor/harbor
synced 2025-05-19 10:10:27 +00:00
fix JS minification issues.
This commit is contained in:
parent
1bcf243d8b
commit
b163735e53
@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
echo "This shell will minify the Javascript in Harbor project."
|
echo "This shell will minify the Javascript in Harbor project."
|
||||||
echo "Usage: #jsminify [src] [dest]"
|
echo "Usage: #jsminify [src] [dest]"
|
||||||
@ -9,26 +9,26 @@ rm -rf $2 /tmp/harbor.app.temp.js
|
|||||||
BASEPATH=/go/bin
|
BASEPATH=/go/bin
|
||||||
#concat the js files from js include file
|
#concat the js files from js include file
|
||||||
echo "Concat js files..."
|
echo "Concat js files..."
|
||||||
cat $1 |while read LINE
|
|
||||||
|
cat $1 | while read LINE || [[ -n $LINE ]]
|
||||||
do
|
do
|
||||||
if [ -n "$LINE" ]
|
if [ -n "$LINE" ]
|
||||||
then
|
then
|
||||||
TEMP="$BASEPATH""$LINE"
|
TEMP="$BASEPATH""$LINE"
|
||||||
cat `echo "$TEMP" | sed 's/<script src=\"//g' |sed 's/\"><\/script>//g'` >> /tmp/harbor.app.temp.js
|
cat `echo "$TEMP" | sed 's/<script src=\"//g' | sed 's/\"><\/script>//g'` >> /tmp/harbor.app.temp.js
|
||||||
printf "\n" >> /tmp/harbor.app.temp.js
|
printf "\n" >> /tmp/harbor.app.temp.js
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
#remove space
|
#remove space
|
||||||
echo "Remove space.."
|
echo "Remove space.."
|
||||||
sed 's/ //g' -i /tmp/harbor.app.temp.js
|
sed 's/ \+/ /g' -i /tmp/harbor.app.temp.js
|
||||||
|
|
||||||
#remove '//' and '/*'
|
#remove '//' and '/*'
|
||||||
echo "Remove '//'and '/*' annotation..."
|
echo "Remove '//'and '/*' annotation..."
|
||||||
sed '/^\/\//'d -i /tmp/harbor.app.temp.js
|
sed '/^\/\//'d -i /tmp/harbor.app.temp.js
|
||||||
sed '/\/\*/{/\*\//d;:a;N;/\*\//d;ba};s,//.*,,' -i /tmp/harbor.app.temp.js
|
sed '/\/\*/{/\*\//d;:a;N;/\*\//d;ba};s,//.*,,' -i /tmp/harbor.app.temp.js
|
||||||
|
|
||||||
|
|
||||||
cat > $2 << EOF
|
cat > $2 << EOF
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2016 VMware, Inc. All Rights Reserved.
|
Copyright (c) 2016 VMware, Inc. All Rights Reserved.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user