Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Read <eread@gitlab.com>2022-05-23 06:57:50 +0300
committerEvan Read <eread@gitlab.com>2022-05-25 01:53:53 +0300
commit1fe7254ff46dab7e6bd02891a0a174f46e4955b0 (patch)
tree17a6c7279396313f1c8fc3854ec3fe4fbdbedab2 /scripts
parent8b88e23f022b1f1b980ee1862545e63d505ebfa7 (diff)
Support local Stylelint runseread/support-local-stylelint-runs
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/run-stylelint.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/scripts/run-stylelint.sh b/scripts/run-stylelint.sh
new file mode 100755
index 00000000..ec8c7c18
--- /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