#!/bin/bash basepath=$(dirname $0) server_prefix=/zanui/icon # convert relative path to absolute path function abspath() { pushd . > /dev/null; if [ -d "$1" ]; then cd "$1"; dirs -l +0; else cd "`dirname \"$1\"`"; cur_dir=`dirs -l +0`; if [ "$cur_dir" == "/" ]; then echo "$cur_dir`basename \"$1\"`"; else echo "$cur_dir/`basename \"$1\"`"; fi; fi; popd > /dev/null; } command_exists () { type "$1" >/dev/null 2>&1 } fontname() { if command_exists superman ; then echo "https://b.yzcdn.cn$server_prefix/$(basename $basepath/../build/font/vant-icon-*.$1)" else echo "$(abspath $basepath/../build/font/vant-icon-*.$1)" fi } # generate font files from sketch file $basepath/extract-icons.sh $basepath/generate-font.sh if command_exists superman ; then # upload to cdn superman cdn $server_prefix $basepath/../build/font/vant-icon-* fi # generate fontface style eot=$(fontname eot) cat > $basepath/../src/icon.css <> $basepath/../src/icon.css