node-sass.yml 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. name: CSS (node-sass)
  2. on:
  3. push:
  4. branches:
  5. - main
  6. pull_request:
  7. workflow_dispatch:
  8. env:
  9. FORCE_COLOR: 2
  10. NODE: 20
  11. permissions:
  12. contents: read
  13. jobs:
  14. css:
  15. runs-on: ubuntu-latest
  16. steps:
  17. - name: Clone repository
  18. uses: actions/checkout@v4
  19. with:
  20. persist-credentials: false
  21. - name: Set up Node.js
  22. uses: actions/setup-node@v4
  23. with:
  24. node-version: "${{ env.NODE }}"
  25. - name: Build CSS with node-sass
  26. run: |
  27. npx --package node-sass@latest node-sass --version
  28. npx --package node-sass@latest node-sass --output-style expanded --source-map true --source-map-contents true --precision 6 scss/ -o dist-sass/css/
  29. ls -Al dist-sass/css
  30. - name: Check built CSS files for Sass variables
  31. shell: bash
  32. run: |
  33. SASS_VARS_FOUND=$(find "dist-sass/css/" -type f -name "*.css" -print0 | xargs -0 --no-run-if-empty grep -F "\$" || true)
  34. if [[ -z "$SASS_VARS_FOUND" ]]; then
  35. echo "All good, no Sass variables found!"
  36. exit 0
  37. else
  38. echo "Found $(echo "$SASS_VARS_FOUND" | wc -l | bc) Sass variables:"
  39. echo "$SASS_VARS_FOUND"
  40. exit 1
  41. fi