mirror of
				https://github.com/SuperBFG7/ympd
				synced 2025-10-31 05:43:01 +00:00 
			
		
		
		
	Fix: minifying css and js
This commit is contained in:
		| @@ -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) { | ||||||
|   | |||||||
							
								
								
									
										91
									
								
								mkrelease.sh
									
									
									
									
									
								
							
							
						
						
									
										91
									
								
								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 { | ||||||
| then |   TYPE="$1" | ||||||
|   echo "Minifying javascript" |   SRC="$2" | ||||||
|   [ htdocs/js/player.js -nt dist/htdocs/js/player.min.js ] && \ |   DST="$3" | ||||||
|     java -jar dist/buildtools/closure-compiler.jar htdocs/js/player.js > dist/htdocs/js/player.min.js |   ERROR="1" | ||||||
|   [ htdocs/js/mympd.js -nt  dist/htdocs/js/mympd.min.js ] && \ |  | ||||||
|     java -jar dist/buildtools/closure-compiler.jar htdocs/js/mympd.js > dist/htdocs/js/mympd.min.js |  | ||||||
|   [ htdocs/sw.js -nt dist/htdocs/sw.min.js ] && \ |  | ||||||
|     java -jar dist/buildtools/closure-compiler.jar htdocs/sw.js > dist/htdocs/sw.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" != "" ] |   [ "$DST" -nt "$SRC" ] && return | ||||||
| then |  | ||||||
|   echo "Minifying stylesheets" |   if [ "$TYPE" == "html" ] | ||||||
|   [ htdocs/css/mympd.css -nt dist/htdocs/css/mympd.min.css ] && \ |   then | ||||||
|     java -jar dist/buildtools/closure-stylesheets.jar --allow-unrecognized-properties htdocs/css/mympd.css > dist/htdocs/css/mympd.min.css |     perl -pe 's/^\s*//gm; s/\s*$//gm' $SRC > $DST | ||||||
| else |     ERROR="$?" | ||||||
|   echo "dist/buildtools/closure-stylesheets.jar not found, using non-minified files" |   elif [ "$TYPE" = "js" ] && [ "$HASJAVA" = "1" ] | ||||||
|   [ htdocs/css/mympd.css -nt dist/htdocs/css/mympd.min.css ] && \ |   then | ||||||
|     cp htdocs/css/mympd.css dist/htdocs/css/mympd.min.css     |     $JAVABIN -jar dist/buildtools/closure-compiler.jar $SRC > $DST | ||||||
| fi |     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" | ||||||
|  | minify js htdocs/js/player.js dist/htdocs/js/player.min.js | ||||||
|  | minify js htdocs/js/mympd.js dist/htdocs/js/mympd.min.js | ||||||
|  | minify js htdocs/sw.js dist/htdocs/sw.min.js | ||||||
|  | minify js htdocs/js/keymap.js dist/htdocs/js/keymap.min.js | ||||||
|  | minify js htdocs/js/keymap.js dist/htdocs/js/keymap.min.js | ||||||
|  | minify js dist/htdocs/js/bootstrap-native-v4.js dist/htdocs/js/bootstrap-native-v4.min.js | ||||||
|  |  | ||||||
|  | echo "Minifying stylesheets" | ||||||
|  | minify css htdocs/css/mympd.css dist/htdocs/css/mympd.min.css | ||||||
|  |  | ||||||
| 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 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 jcorporation
					jcorporation