stylelint/entrypoint.sh
Serhiy Mytrovtsiy 8887c617d2 first commit
2019-08-21 22:01:23 +02:00

31 lines
No EOL
533 B
Bash

#!/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"