diff options
-rw-r--r-- | .gitlab-ci.yml | 5 | ||||
-rw-r--r-- | .stylelintrc | 3 | ||||
-rw-r--r-- | Makefile | 7 | ||||
-rw-r--r-- | content/assets/stylesheets/_docsearch.scss | 6 | ||||
-rw-r--r-- | content/assets/stylesheets/mixins/_breakpoints.scss | 6 | ||||
-rw-r--r-- | content/assets/stylesheets/toc.scss | 1 | ||||
-rw-r--r-- | doc/testing.md | 2 | ||||
-rwxr-xr-x | scripts/run-stylelint.sh | 19 |
8 files changed, 36 insertions, 13 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c256e766..591825af 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -337,10 +337,7 @@ stylelint: needs: [] stage: test script: - # Remove the first three lines so the frontmatter doesn't - # cause stylelint to throw errors. - - sed -i -E '1,3d' content/assets/stylesheets/*.scss - - yarn run stylelint content/assets/stylesheets/*.scss + - scripts/run-stylelint.sh # # Yamllint of *.yml for .gitlab-ci.yml. diff --git a/.stylelintrc b/.stylelintrc index 9890ace1..e29eea7b 100644 --- a/.stylelintrc +++ b/.stylelintrc @@ -7,6 +7,7 @@ "declaration-block-semicolon-newline-after": null, "max-nesting-depth": 4, "rule-empty-line-before": null, - "selector-max-compound-selectors": 4 + "selector-max-compound-selectors": 4, + "media-feature-name-no-vendor-prefix": null } } @@ -98,3 +98,10 @@ brew-bundle: test: setup brew-bundle @printf "\n$(INFO)INFO: Running all tests..$(INFO_END)\n" @bundle exec rspec && yarn test && yarn eslint && yarn prettier && hadolint latest.Dockerfile .gitpod.Dockerfile **/*.Dockerfile && yamllint .gitlab-ci.yml content/_data + @bundle exec rspec + @yarn test + @yarn eslint + @yarn prettier + @scripts/run-stylelint.sh + @hadolint latest.Dockerfile .gitpod.Dockerfile **/*.Dockerfile + @yamllint .gitlab-ci.yml content/_data diff --git a/content/assets/stylesheets/_docsearch.scss b/content/assets/stylesheets/_docsearch.scss index bd292c76..e458e341 100644 --- a/content/assets/stylesheets/_docsearch.scss +++ b/content/assets/stylesheets/_docsearch.scss @@ -1,10 +1,10 @@ --- -version: 1 +version: 2 --- @import 'variables'; -/* stylelint-disable declaration-no-important */ +/* stylelint-disable selector-class-pattern */ .DocSearch-Hit-source { color: $gray-700 !important; } @@ -33,4 +33,4 @@ version: 1 display: none; } -/* stylelint-enable declaration-no-important */ +/* stylelint-enable selector-class-pattern */ diff --git a/content/assets/stylesheets/mixins/_breakpoints.scss b/content/assets/stylesheets/mixins/_breakpoints.scss index c6918864..2c52e825 100644 --- a/content/assets/stylesheets/mixins/_breakpoints.scss +++ b/content/assets/stylesheets/mixins/_breakpoints.scss @@ -1,5 +1,5 @@ --- -version: 1 +version: 2 --- // Breakpoints @@ -22,8 +22,8 @@ version: 1 @media only screen and (min-width: $bp-xl) { @content; } } @else if $min == 2x { @media only screen and (-webkit-min-device-pixel-ratio: 1.5), - only screen and (min--moz-device-pixel-ratio: 1.5), - only screen and (min-device-pixel-ratio: 1.5) { @content; } + only screen and (min--moz-device-pixel-ratio: 1.5), + only screen and (min-device-pixel-ratio: 1.5) { @content; } } @else { @warn 'Breakpoint mixin supports: xs, sm, md, lg, xl, 2x'; } diff --git a/content/assets/stylesheets/toc.scss b/content/assets/stylesheets/toc.scss index 6292e572..1cf1df32 100644 --- a/content/assets/stylesheets/toc.scss +++ b/content/assets/stylesheets/toc.scss @@ -1,6 +1,7 @@ --- version: 23 --- + @import 'variables'; @import 'utilities'; diff --git a/doc/testing.md b/doc/testing.md index e0ee93aa..27e0a53f 100644 --- a/doc/testing.md +++ b/doc/testing.md @@ -20,8 +20,6 @@ These code tests are included in the project: | Vue | Jest | Unit tests | | YAML | yamllint | Syntax checks | -Stylelint tests are run in the CI/CD pipeline only. - ### Run code tests locally To run the tests: 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 |