stylelint/entrypoint.sh

31 lines
533 B
Bash
Raw Permalink Normal View History

2019-08-21 16:01:23 -04:00
#!/bin/sh
set -e
stylelint_path="node_modules/.bin/stylelint"
indent_spaces=2
if [ ! -e stylelint_path ]; then
yarn add stylelint stylelint-config-standard --silent
fi
if [ ! -e "./.stylelintrc" ]; then
if [ -z "${INDENT_SPACES-}" ]; then
indent_spaces=$INDENT_SPACES
fi
echo "{
\"extends\": \"stylelint-config-standard\",
\"rules\": {
\"indentation\": "$indent_spaces"
}
}" > .stylelintrc
fi
if [ -z "$*" ]; then
pattern="./*.css"
else
pattern="$*"
fi
sh -c "$stylelint_path $pattern"