mirror of
https://github.com/SuperBFG7/ympd
synced 2025-07-04 02:53:09 +00:00
Fix: minifying css and js
This commit is contained in:
parent
df18a9f970
commit
6c94b1742f
@ -11,8 +11,7 @@ html {
|
|||||||
body {
|
body {
|
||||||
padding-top: 4rem;
|
padding-top: 4rem;
|
||||||
padding-bottom: 4rem;
|
padding-bottom: 4rem;
|
||||||
background-color: #888;
|
background-color: var(--mympd-backgroundcolor, #888);
|
||||||
background-color: var(--mympd-backgroundcolor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
main {
|
main {
|
||||||
@ -74,9 +73,9 @@ small {
|
|||||||
border: 1px solid black;
|
border: 1px solid black;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
width: var(--mympd-coverimagesize);
|
width: var(--mympd-coverimagesize, 250px);
|
||||||
max-width:100%;
|
max-width:100%;
|
||||||
height: var(--mympd-coverimagesize);
|
height: var(--mympd-coverimagesize, 250px);
|
||||||
background-color: #eee;
|
background-color: #eee;
|
||||||
float: left;
|
float: left;
|
||||||
margin-right: 1.25rem;
|
margin-right: 1.25rem;
|
||||||
@ -333,7 +332,7 @@ div.key {
|
|||||||
background-color: #eee;
|
background-color: #eee;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
width: 20px;
|
width: 20px;
|
||||||
heigth: 20px;
|
height: 20px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1069,9 +1069,6 @@ function webSocketConnect() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
socket.onmessage = function got_packet(msg) {
|
socket.onmessage = function got_packet(msg) {
|
||||||
if (msg.data === lastState || msg.data.length == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var obj = JSON.parse(msg.data);
|
var obj = JSON.parse(msg.data);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
|
85
mkrelease.sh
85
mkrelease.sh
@ -1,52 +1,57 @@
|
|||||||
#/bin/sh
|
#/bin/sh
|
||||||
|
|
||||||
java=$(which java 2> /dev/null)
|
JAVABIN=$(which java 2> /dev/null)
|
||||||
|
HASJAVA="$?"
|
||||||
|
|
||||||
if [ -f dist/buildtools/closure-compiler.jar ] && [ "$java" != "" ]
|
function minify {
|
||||||
|
TYPE="$1"
|
||||||
|
SRC="$2"
|
||||||
|
DST="$3"
|
||||||
|
ERROR="1"
|
||||||
|
|
||||||
|
[ "$DST" -nt "$SRC" ] && return
|
||||||
|
|
||||||
|
if [ "$TYPE" == "html" ]
|
||||||
then
|
then
|
||||||
|
perl -pe 's/^\s*//gm; s/\s*$//gm' $SRC > $DST
|
||||||
|
ERROR="$?"
|
||||||
|
elif [ "$TYPE" = "js" ] && [ "$HASJAVA" = "1" ]
|
||||||
|
then
|
||||||
|
$JAVABIN -jar dist/buildtools/closure-compiler.jar $SRC > $DST
|
||||||
|
ERROR="$?"
|
||||||
|
elif [ "$TYPE" = "css" ] && [ "$HASJAVA" = "1" ]
|
||||||
|
then
|
||||||
|
$JAVABIN -jar dist/buildtools/closure-stylesheets.jar --allow-unrecognized-properties $SRC > $DST
|
||||||
|
ERROR="$?"
|
||||||
|
elif [ "$TYPE" = "cp" ]
|
||||||
|
then
|
||||||
|
cp $SRC $DST
|
||||||
|
ERROR="$?"
|
||||||
|
else
|
||||||
|
ERROR="1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$ERROR" = "1" ]
|
||||||
|
then
|
||||||
|
echo "Error minifying $SRC, copy $SRC to $DST"
|
||||||
|
cp $SRC $DST
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
echo "Minifying javascript"
|
echo "Minifying javascript"
|
||||||
[ htdocs/js/player.js -nt dist/htdocs/js/player.min.js ] && \
|
minify js htdocs/js/player.js dist/htdocs/js/player.min.js
|
||||||
java -jar dist/buildtools/closure-compiler.jar htdocs/js/player.js > dist/htdocs/js/player.min.js
|
minify js htdocs/js/mympd.js dist/htdocs/js/mympd.min.js
|
||||||
[ htdocs/js/mympd.js -nt dist/htdocs/js/mympd.min.js ] && \
|
minify js htdocs/sw.js dist/htdocs/sw.min.js
|
||||||
java -jar dist/buildtools/closure-compiler.jar htdocs/js/mympd.js > dist/htdocs/js/mympd.min.js
|
minify js htdocs/js/keymap.js dist/htdocs/js/keymap.min.js
|
||||||
[ htdocs/sw.js -nt dist/htdocs/sw.min.js ] && \
|
minify js htdocs/js/keymap.js dist/htdocs/js/keymap.min.js
|
||||||
java -jar dist/buildtools/closure-compiler.jar htdocs/sw.js > dist/htdocs/sw.min.js
|
minify js dist/htdocs/js/bootstrap-native-v4.js dist/htdocs/js/bootstrap-native-v4.min.js
|
||||||
[ htdocs/js/keymap.js -nt dist/htdocs/js/keymap.min.js ] && \
|
|
||||||
java -jar dist/buildtools/closure-compiler.jar htdocs/js/keymap.js > dist/htdocs/js/keymap.min.js
|
|
||||||
[ htdocs/js/keymap.js -nt dist/htdocs/js/keymap.min.js ] && \
|
|
||||||
java -jar dist/buildtools/closure-compiler.jar htdocs/js/keymap.js > dist/htdocs/js/keymap.min.js
|
|
||||||
[ dist/htdocs/js/bootstrap-native-v4.js -nt dist/htdocs/js/bootstrap-native-v4.min.js ] && \
|
|
||||||
java -jar dist/buildtools/closure-compiler.jar dist/htdocs/js/bootstrap-native-v4.js > dist/htdocs/js/bootstrap-native-v4.min.js
|
|
||||||
else
|
|
||||||
echo "dist/buildtools/closure-compiler.jar not found, using non-minified files"
|
|
||||||
[ htdocs/js/player.js -nt dist/htdocs/js/player.min.js ] && \
|
|
||||||
cp htdocs/js/player.js dist/htdocs/js/player.min.js
|
|
||||||
[ htdocs/js/mympd.js -nt dist/htdocs/js/mympd.min.js ] && \
|
|
||||||
cp htdocs/js/mympd.js dist/htdocs/js/mympd.min.js
|
|
||||||
[ htdocs/sw.js -nt dist/htdocs/sw.min.js ] && \
|
|
||||||
cp htdocs/sw.js dist/htdocs/sw.min.js
|
|
||||||
[ htdocs/js/keymap.js -nt dist/htdocs/js/keymap.min.js ] && \
|
|
||||||
cp htdocs/js/keymap.js dist/htdocs/js/keymap.min.js
|
|
||||||
[ dist/htdocs/js/bootstrap-native-v4.js -nt dist/htdocs/js/bootstrap-native-v4.min.js ] && \
|
|
||||||
cp dist/htdocs/js/bootstrap-native-v4.js dist/htdocs/js/bootstrap-native-v4.min.js
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f dist/buildtools/closure-stylesheets.jar ] && [ "$java" != "" ]
|
|
||||||
then
|
|
||||||
echo "Minifying stylesheets"
|
echo "Minifying stylesheets"
|
||||||
[ htdocs/css/mympd.css -nt dist/htdocs/css/mympd.min.css ] && \
|
minify css htdocs/css/mympd.css dist/htdocs/css/mympd.min.css
|
||||||
java -jar dist/buildtools/closure-stylesheets.jar --allow-unrecognized-properties htdocs/css/mympd.css > dist/htdocs/css/mympd.min.css
|
|
||||||
else
|
|
||||||
echo "dist/buildtools/closure-stylesheets.jar not found, using non-minified files"
|
|
||||||
[ htdocs/css/mympd.css -nt dist/htdocs/css/mympd.min.css ] && \
|
|
||||||
cp htdocs/css/mympd.css dist/htdocs/css/mympd.min.css
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Minifying html"
|
echo "Minifying html"
|
||||||
[ htdocs/index.html -nt dist/htdocs/index.html ] && \
|
minify html htdocs/index.html dist/htdocs/index.html
|
||||||
perl -pe 's/^\s*//gm; s/\s*$//gm' htdocs/index.html > dist/htdocs/index.html
|
minify html htdocs/player.html dist/htdocs/player.html
|
||||||
[ htdocs/player.html -nt dist/htdocs/player.html ] && \
|
|
||||||
perl -pe 's/^\s*//gm; s/\s*$//gm' htdocs/player.html > dist/htdocs/player.html
|
|
||||||
|
|
||||||
echo "Compiling and installing mympd"
|
echo "Compiling and installing mympd"
|
||||||
[ -d release ] || mkdir release
|
[ -d release ] || mkdir release
|
||||||
|
Loading…
x
Reference in New Issue
Block a user