2024-11-10 06:58:04 +01:00
|
|
|
#!/bin/bash
|
|
|
|
# MyPlayer - Copyright 2014 - 2024 tilt@linuxfoo.de GPLv3
|
|
|
|
# Build Script; generates a minified collective CSS file
|
|
|
|
|
|
|
|
dir=$(readlink -f "$(dirname "$0")")
|
|
|
|
|
2024-11-10 07:48:37 +01:00
|
|
|
cssdir="$(readlink -f "$dir/../dist/css")"
|
|
|
|
|
2024-11-10 06:58:04 +01:00
|
|
|
if ! cd "$dir" ; then
|
|
|
|
echo "ERROR: Could not change working directory; aborted." >&2 ;
|
|
|
|
exit 1 ;
|
2024-11-10 07:48:37 +01:00
|
|
|
elif ! mkdir -p "$cssdir" ; then
|
|
|
|
echo "ERROR: Could not create directory $cssdir; aborted." >&2 ;
|
|
|
|
exit 1 ;
|
2024-11-10 06:58:04 +01:00
|
|
|
elif [[ -z $(type -p r.js) ]] ; then
|
|
|
|
echo "ERROR: r.js optimizer not found; install it using 'npm install -g requirejs'." >&2
|
|
|
|
exit 1
|
2024-11-10 07:48:37 +01:00
|
|
|
elif ! r.js -o cssIn=myplayer.css out="$cssdir"/myplayer.min.css optimizeCss=standard.keepComments.keepLines ; then
|
2024-11-10 06:58:04 +01:00
|
|
|
echo "ERROR: r.js failed; aborted." >&2
|
|
|
|
exit 1
|
|
|
|
else
|
2024-11-10 07:48:37 +01:00
|
|
|
sed -i -e 's|../mediaelement-plugins/dist/playlist/||' "$cssdir"/myplayer.min.css
|
|
|
|
chmod 0644 "$cssdir"/myplayer.min.css
|
2024-11-10 06:58:04 +01:00
|
|
|
|
2024-11-10 07:48:37 +01:00
|
|
|
echo "INFO: Minimized CSS to $cssdir/myplayer.min.css" >&2
|
2024-11-10 06:58:04 +01:00
|
|
|
|
|
|
|
for svg in \
|
|
|
|
../mediaelement-plugins/dist/playlist/playlist-controls.svg \
|
|
|
|
../mediaelement/build/mejs-controls.svg
|
|
|
|
do
|
2024-11-10 07:48:37 +01:00
|
|
|
svg_out="$cssdir/$(basename "$svg")"
|
2024-11-10 06:58:04 +01:00
|
|
|
|
|
|
|
if ! cp "$svg" "$svg_out" ; then
|
|
|
|
echo "ERROR: Copying controls SVG $svg failed; aborted." >&2
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "INFO: Copied controls SVG to $svg_out" >&2
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|