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
|
2019-10-25 13:35:47 -04:00
|
|
|
yarn add stylelint stylelint-config-standard --silent
|
2019-08-21 16:01:23 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -e "./.stylelintrc" ]; then
|
2019-10-25 13:35:47 -04:00
|
|
|
if [ -z "${INDENT_SPACES-}" ]; then
|
|
|
|
indent_spaces=$INDENT_SPACES
|
|
|
|
fi
|
2019-08-21 16:01:23 -04:00
|
|
|
|
2019-10-25 13:35:47 -04:00
|
|
|
echo "{
|
2019-08-21 16:01:23 -04:00
|
|
|
\"extends\": \"stylelint-config-standard\",
|
|
|
|
\"rules\": {
|
|
|
|
\"indentation\": "$indent_spaces"
|
|
|
|
}
|
|
|
|
}" > .stylelintrc
|
|
|
|
fi
|
|
|
|
|
2019-10-25 13:35:47 -04:00
|
|
|
pattern="./*.css"
|
|
|
|
if [ ! -z "${PATTERN}" ]; then
|
|
|
|
pattern=$PATTERN
|
2019-08-21 16:01:23 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
sh -c "$stylelint_path $pattern"
|