1
1
mirror of https://github.com/primer/css.git synced 2024-11-30 01:04:04 +03:00
css/script/dist
2019-02-07 16:12:08 -08:00

29 lines
618 B
Bash
Executable File

#!/bin/bash
set -e
outdir=dist
rm -rf $outdir
mkdir -p src/$outdir
pushd src > /dev/null
indexes=$(find . -name index.scss | perl -pe 's#^\./##')
root=$(pwd)
for index in $indexes; do
if [[ $index = "index.scss" ]]; then
dir=.
name="primer"
else
dir=$(dirname $index)
name=${dir//\//-}
fi
file="$outdir/$name.css"
pushd $dir > /dev/null
echo "[dist] $index -> $file"
npx node-sass --include-path=$root index.scss > "$root/$file"
npx cssstats "$root/$file" > "$root/$outdir/$name.json"
popd > /dev/null
done
popd > /dev/null
mv src/$outdir $outdir