Merged in feature/MAPG-62-minify-svg-after-deployment (pull request #43)
Feature/MAPG-62 minify svg after deployment
This commit is contained in:
commit
4dbb8a7cba
@ -23,8 +23,7 @@ RUN ./install-composer.sh
|
|||||||
# Install Node.js and required packages
|
# Install Node.js and required packages
|
||||||
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash -
|
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash -
|
||||||
RUN apt install -y nodejs
|
RUN apt install -y nodejs
|
||||||
RUN npm install -g uglify-js
|
RUN npm install -g uglify-js clean-css-cli html-minifier
|
||||||
RUN npm install -g clean-css-cli
|
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
VOLUME /var/www/mapguesser
|
VOLUME /var/www/mapguesser
|
||||||
|
@ -5,7 +5,7 @@ ROOT_DIR=$(dirname $(readlink -f "$0"))/..
|
|||||||
. ${ROOT_DIR}/.env
|
. ${ROOT_DIR}/.env
|
||||||
|
|
||||||
if [ -f ${ROOT_DIR}/installed ]; then
|
if [ -f ${ROOT_DIR}/installed ]; then
|
||||||
echo "Mapguesser is already installed! To force reinstall, delete file 'installed' from the root directory!"
|
echo "MapGuesser is already installed! To force reinstall, delete file 'installed' from the root directory!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -14,10 +14,9 @@ echo "Installing MapGuesser DB..."
|
|||||||
mysql --host=${DB_HOST} --user=${DB_USER} --password=${DB_PASSWORD} ${DB_NAME} < ${ROOT_DIR}/db/mapguesser.sql
|
mysql --host=${DB_HOST} --user=${DB_USER} --password=${DB_PASSWORD} ${DB_NAME} < ${ROOT_DIR}/db/mapguesser.sql
|
||||||
|
|
||||||
if [ -z "${DEV}" ] || [ "${DEV}" -eq "0" ]; then
|
if [ -z "${DEV}" ] || [ "${DEV}" -eq "0" ]; then
|
||||||
echo "Uglifying JS and CSS files..."
|
echo "Minifying JS, CSS and SVG files..."
|
||||||
|
|
||||||
uglifyjs ${ROOT_DIR}/public/static/js/mapguesser.js -c -m -o ${ROOT_DIR}/public/static/js/mapguesser.js
|
${ROOT_DIR}/scripts/minify.sh
|
||||||
cleancss ${ROOT_DIR}/public/static/css/mapguesser.css -o ${ROOT_DIR}/public/static/css/mapguesser.css
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
touch ${ROOT_DIR}/installed
|
touch ${ROOT_DIR}/installed
|
||||||
|
9
scripts/minify.sh
Executable file
9
scripts/minify.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
ROOT_DIR=$(dirname $(readlink -f "$0"))/..
|
||||||
|
|
||||||
|
. ${ROOT_DIR}/.env
|
||||||
|
|
||||||
|
uglifyjs ${ROOT_DIR}/public/static/js/mapguesser.js -c -m -o ${ROOT_DIR}/public/static/js/mapguesser.js
|
||||||
|
cleancss ${ROOT_DIR}/public/static/css/mapguesser.css -o ${ROOT_DIR}/public/static/css/mapguesser.css
|
||||||
|
html-minifier ${ROOT_DIR}/public/static/img/loading.svg --collapse-whitespace --remove-comments -o ${ROOT_DIR}/public/static/img/loading.svg
|
@ -5,8 +5,7 @@ ROOT_DIR=$(dirname $(readlink -f "$0"))/..
|
|||||||
. ${ROOT_DIR}/.env
|
. ${ROOT_DIR}/.env
|
||||||
|
|
||||||
if [ -z "${DEV}" ] || [ "${DEV}" -eq "0" ]; then
|
if [ -z "${DEV}" ] || [ "${DEV}" -eq "0" ]; then
|
||||||
echo "Uglifying JS and CSS files..."
|
echo "Minifying JS, CSS and SVG files..."
|
||||||
|
|
||||||
uglifyjs ${ROOT_DIR}/public/static/js/mapguesser.js -c -m -o ${ROOT_DIR}/public/static/js/mapguesser.js
|
${ROOT_DIR}/scripts/minify.sh
|
||||||
cleancss ${ROOT_DIR}/public/static/css/mapguesser.css -o ${ROOT_DIR}/public/static/css/mapguesser.css
|
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user