Skip to content

Change logic of input and output targets of post-processing scripts

Achilleas Pipinellis requested to merge axil-fix-minify-run into main

What does this MR do and why?

Change logic of input and output targets of post-processing scripts. This was mainly done to make minify work again.

  • Simplify compress_images.sh to provide only one target.
  • Simplify normalize-links.sh to provide output and input targets.
  • Simplify minify-assets.sh to provide output and input targets, and run minify only once in the whole site directory.
  • Change single.Dockerfile to account for the script changes.

Fixes #1612 (closed).

How to set up and validate locally

Without Docker

  1. Configure a local GitLab Docs environment: https://gitlab.com/gitlab-org/gitlab-docs/-/blob/main/doc/setup.md.
  2. Check out this branch.
  3. Compile the site:
    make compile
  4. Use the scripts for post-processing:
    scripts/normalize-links.sh public 15.11
    scripts/compress_images.sh public
    mkdir dest
    scripts/minify-assets.sh dest public
  5. When minify-assets.sh is run, you should see the following output:
    INFO: Assets minified!
    INFO: Size before minifying: 2.4G
    INFO: Size after minifying: 950M
    INFO: Checking that the number of source and destination files is the same...
    SUCCESS: File count in public and dest: 3005/3005
    INFO: Checking that the number of source and destination directories is the same...
    SUCCESS: Directory count in public and dest: 630/630

Mimicking the Docker build

  1. Configure a local GitLab Docs environment: https://gitlab.com/gitlab-org/gitlab-docs/-/blob/main/doc/setup.md.
  2. Check out this branch.
  3. Build the 15.11 image:
    docker build --build-arg NANOC_ENV=production --build-arg VER=15.11 --build-arg SEARCH_BACKEND="lunr" --tag docs:15.11 -f dockerfiles/single.Dockerfile .

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 Achilleas Pipinellis

Merge request reports