1
1
mirror of https://github.com/primer/css.git synced 2025-01-05 21:22:57 +03:00

chore: un-ignored scripts/build

This commit is contained in:
Shawn Allen 2019-01-28 14:52:45 -08:00
parent 635df5478b
commit 8432372d4a
2 changed files with 27 additions and 0 deletions

1
modules/primer/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
!scripts/build

26
modules/primer/scripts/build Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
set -e
outdir=build
rm -rf $outdir
mkdir -p $outdir
indexes=$(find . -name index.scss | egrep -v node_modules | 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 "[build] $index -> $file"
npx node-sass --include-path=$root index.scss > "$root/$file"
npx cssstats "$root/$file" > "$root/$outdir/$name.json"
echo "module.exports = {cssstats: require('./$name.json')}" > "$root/$outdir/$name.js"
popd > /dev/null
done