node-sass.yml 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. name: CSS (node-sass)
  2. on:
  3. push:
  4. branches-ignore:
  5. - "dependabot/**"
  6. pull_request:
  7. workflow_dispatch:
  8. env:
  9. FORCE_COLOR: 2
  10. NODE: 18
  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@v3
  23. with:
  24. node-version: "${{ env.NODE }}"
  25. cache: npm
  26. - name: Install npm dependencies
  27. run: npm ci
  28. - name: Build CSS with node-sass
  29. run: |
  30. npx --package node-sass@latest node-sass --version
  31. npx --package node-sass@latest node-sass --include-path=node_modules --output-style expanded --source-map true --source-map-contents true --precision 6 src/scss/ -o dist-sass/css/
  32. ls -Al dist-sass/css
  33. # Check that there are no Sass variables (`$`)
  34. - name: Check built CSS files
  35. shell: bash
  36. run: |
  37. SASS_VARS_FOUND=$(find "dist-sass/css/" -type f -name "*.css" -print0 | xargs -0 --no-run-if-empty grep -F "\$" || true)
  38. if [[ -z "$SASS_VARS_FOUND" ]]; then
  39. echo "All good, no Sass variables found!"
  40. exit 0
  41. else
  42. echo "Found $(echo "$SASS_VARS_FOUND" | wc -l | bc) Sass variables:"
  43. echo "$SASS_VARS_FOUND"
  44. exit 1
  45. fi