diff options
author | Evan Read <eread@gitlab.com> | 2022-05-23 06:57:50 +0300 |
---|---|---|
committer | Evan Read <eread@gitlab.com> | 2022-05-25 01:53:53 +0300 |
commit | 1fe7254ff46dab7e6bd02891a0a174f46e4955b0 (patch) | |
tree | 17a6c7279396313f1c8fc3854ec3fe4fbdbedab2 /scripts | |
parent | 8b88e23f022b1f1b980ee1862545e63d505ebfa7 (diff) |
Support local Stylelint runseread/support-local-stylelint-runs
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/run-stylelint.sh | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/scripts/run-stylelint.sh b/scripts/run-stylelint.sh new file mode 100755 index 000000000..ec8c7c18f --- /dev/null +++ b/scripts/run-stylelint.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +STYLESHEETS="content/assets/stylesheets/*.scss" +MIXINS_STYLESHEETS="content/assets/stylesheets/mixins/*.scss" +ALL_STYLESHEETS="content/assets/stylesheets/*.scss content/assets/stylesheets/mixins/*.scss" + +# Preseve original content in temporary files and then strip YAML frontmatter from stylesheets +for stylesheet in $ALL_STYLESHEETS; do + cp "$stylesheet" "$stylesheet-tmp" + tail -n +5 "$stylesheet-tmp" > "$stylesheet" +done + +yarn stylelint "$STYLESHEETS" +yarn stylelint "$MIXINS_STYLESHEETS" + +# Restore original contents of stylesheets +for stylesheet in $ALL_STYLESHEETS; do + mv "$stylesheet-tmp" "$stylesheet" +done |