mirror of
https://github.com/actions-hub/stylelint.git
synced 2024-11-22 16:00:54 -05:00
31 lines
No EOL
533 B
Bash
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" |