Skip to content

Refactor minify-assets.sh script

Evan Read requested to merge eread/refactor-minify-assets-script into main

What does this MR do and why?

Simplify the minify-assets.sh script so it's easier to understand and maintain.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Configure a local GitLab Docs environment: https://gitlab.com/gitlab-org/gitlab-docs/-/blob/main/doc/setup.md.

  2. Check out branch.

  3. Run make clean && make compile.

  4. Run docker build -f dockerfiles/single.Dockerfile . --build-arg VER=15.10. It should succeed.

  5. Update minify-assets.sh to make an invalid call. For example:

    -if $MINIFY_BIN "${MINIFY_FLAGS[@]}" --type=html --match="\.html$" -o "${TARGET}/${VER}/" "${TARGET}/${VER}"; then
    +if $MINIFY_BIN "${MINIFY_FLAGS[@]}" --type=html --matches="\.html$" -o "${TARGET}/${VER}/" "${TARGET}/${VER}"; then
  6. Run docker build -f dockerfiles/single.Dockerfile . --build-arg VER=15.10. It should fail.

  7. Run cd public.

  8. Run ../scripts/minify-assets.sh ./ ./. It should succeed.

Merge request acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Evan Read

Merge request reports