# Copyright (C) 2025 Michael Becker  <alcexhim@gmail.com>
# 
# This file is part of mocha-docker.
# 
# mocha-docker is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# mocha-docker is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with mocha-docker.  If not, see <https://www.gnu.org/licenses/>.

#!/bin/bash
OUTPUT="$1"
shift

TARGETS=$@
WORKDIR=$(dirname $1)

cat $TARGETS > $WORKDIR/common.less

pushd $WORKDIR
lessc --verbose --plugin=less-plugin-clean-css common.less output.css
popd

rm $WORKDIR/common.less

mv $WORKDIR/output.css $OUTPUT
