mirror of
https://github.com/primer/css.git
synced 2025-01-07 06:51:03 +03:00
chore: un-ignored scripts/build
This commit is contained in:
parent
635df5478b
commit
8432372d4a
1
modules/primer/.gitignore
vendored
Normal file
1
modules/primer/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
!scripts/build
|
26
modules/primer/scripts/build
Executable file
26
modules/primer/scripts/build
Executable 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
|
Loading…
Reference in New Issue
Block a user