This repository has been archived on 2023-08-16. You can view files and clone it, but cannot push or open issues or pull requests.
footnotes/_tools/build.sh
Rumperuu ac819034e5
release: release 2.7.3 (#144)
* release: release 2.7.2

* fix: urgent 2.7.3 release to fix fatal error

* chore: remove un-needed setup script

* ci: remove steps from pre-push command

* chore: remove un-needed PHP-Commitizen config

* chore: put image files in correct folders

* chore: move GitHub image into `.github/` dir
2021-04-25 21:26:41 +01:00

31 lines
1 KiB
Bash
Executable file

#!/bin/bash
echo "Building Plugin..."
# Moves everything including the style sheets over to `dist/`
echo "Copying directories..."
rm -rf dist/
mkdir dist
cp -r -t dist src/{class,languages,templates,img}/
echo "Copying files..."
cp -t dist ./{SECURITY.md,CHANGELOG.md,wpml-config.xml} src/{license.txt,readme.txt,includes.php}
echo "Setting production flag..."
sed "s/'PRODUCTION_ENV', false/'PRODUCTION_ENV', true/g" src/footnotes.php > dist/footnotes.php
echo "Production flag set."
# TODO: once automatic minification is implemented, this should handle that.
# For now, we shall have to assume that this command is being run on a repo. with
# minimised stylesheet files already in `dist/css/`.
echo "Building stylesheets..."
./_tools/build-stylesheets.sh -c
if [ $? != 0 ]; then echo "Concatenation failed!"; exit 1; fi
echo "Stylesheet build complete."
echo "Minifying CSS and JS..."
mkdir -p dist/{css,js}
npm run minify
if [ $? != 0 ]; then echo "Minification failed!"; exit 1; fi
echo "Minification complete."
echo "Build complete."
exit 0