#!/usr/bin/env bash set -euo pipefail ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" CSS_FILE="$ROOT_DIR/styleguide.css" selectors=( "sg-portal-header" "sg-options-row" "sg-card-list-page-drawer__header" "sg-card-list-page-drawer__content" ) for selector in "${selectors[@]}"; do block="$(awk -v selector=".$selector" ' $0 ~ selector"[[:space:]]*\\{" {in_block=1} in_block {print} in_block && /}/ {exit} ' "$CSS_FILE")" if [[ -z "$block" ]]; then echo "ERROR: selector .$selector not found in styleguide.css" exit 1 fi if echo "$block" | rg -n "(padding|padding-inline|padding-left|padding-right|inset|inset-inline)([^\n;]*)([0-9]+px)" >/dev/null; then echo "ERROR: hardcoded px inset/padding value found in .$selector" echo "$block" exit 1 fi done echo "OK: no hardcoded px inset values in guarded pattern selectors"