Commit 6837963a authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

feat(pages): compress text resources before pushing to GitLab pages

parent 39e06f14
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -58,6 +58,18 @@ pages:
        mkdir -p public
        cp -r ${mkdocs_dist}/* ${target}
      fi
    # compress text resources
    # see: https://docs.gitlab.com/ee/user/project/pages/introduction.html#serving-compressed-assets
    - |
      if command -v gzip > /dev/null; then
        log_info "compressing text resources (gzip)..."
        find public -type f -regex '.*\.\(htm\|html\|txt\|text\|js\|css\|json\)$' -exec gzip -f -k {} \;
      fi
    - |
      if command -v brotli > /dev/null; then
        log_info "compressing text resources (br)..."
        find public -type f -regex '.*\.\(htm\|html\|txt\|text\|js\|css\|json\)$' -exec brotli -f -k {} \;
      fi
  artifacts:
    paths:
      - public