0
0
mirror of https://github.com/Doodle3D/doodle3d-client.git synced 2024-11-22 17:27:57 +01:00
doodle3d-client/lesstocss.sh

72 lines
1.6 KiB
Bash
Raw Normal View History

2013-10-09 18:15:47 +02:00
#!/bin/bash
choices=0
if [ ! -n "$1" ]; then
echo 'no arguments passed.. this will simply convert LESS to CSS.'
echo "in case you're wondering, there's arguments you can pass:"
echo ' -m / --minify = minify css'
echo ' -p / --prefix = apply browser-specific prefixes'
echo ''
fi
2013-10-09 18:15:47 +02:00
2013-10-09 18:15:47 +02:00
if [ -n "$1" ]; then
if [ $1 = '--prefix' ] || [ $1 = '-p' ]; then
# echo 'got prefix'
choices=`expr $choices + 1`
2013-10-09 18:15:47 +02:00
fi
if [ $1 = '--minify' ] || [ $1 = '-m' ]; then
# echo 'got minify'
choices=`expr $choices + 2`
fi
fi
if [ -n "$2" ]; then
if [ $2 = '--prefix' ] || [ $2 = '-p' ]; then
# echo 'got prefix'
choices=`expr $choices + 1`
fi
if [ $2 = '--minify' ] || [ $2 = '-m' ]; then
# echo 'got minify'
choices=`expr $choices + 2`
2013-10-09 18:15:47 +02:00
fi
fi
if [ -a css/styles.min.css ]; then
rm css/styles.min.css
fi
2013-10-09 18:15:47 +02:00
# generate CSS from LESS
echo 'converting LESS to CSS...'
lessc less/styles.less css/styles.css
2013-10-09 18:15:47 +02:00
case "$choices" in
"0")
echo 'just less-to-css'
;;
"1")
echo 'applying prefixr...'
2013-10-09 18:15:47 +02:00
# prefixed (-s overwrites existing file)
prefixr --input ./css/styles.css -s
;;
"2")
echo 'creating minified....'
lessc --yui-compress less/styles.less css/styles.min.css
;;
"3")
2013-10-09 18:15:47 +02:00
echo 'creating minified and prefixed...'
# prefixed (-s overwrites existing file)
prefixr --input ./css/styles.css -s
2013-10-09 18:15:47 +02:00
# copy to .min.css to create a minified version as well
cp css/styles.css css/styles.min.css
# prefixed and minified (-s overwrites existing file)
prefixr --input ./css/styles.min.css -s -c
;;
*)
echo 'catch-all'
;;
esac