Skip to content

Add option to skip frontend compilation

Achilleas Pipinellis requested to merge axil-skip-frontend into main

What does this MR do and why?

When nanoc compile runs, all the JavaScript files under content/frontend/ are compiled as well. This action is not idempotent, so the JavaScript files are built every time Nanoc compiles the site, regardless if a change has been made to one of those files.

This means that even for a small Markdown file change like a typo, you have to wait almost two minutes for the frontend files to finish compiling so that you can preview your change locally.

If you skip compiling the frontend files, it takes around 30 seconds.

Closes #1594 (closed).

How to set up and validate locally

  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. Make a Markdown change in one of the repositories, for example gitlab.

  5. Compile the site again. You'll notice that the frontend files are compiled again although no relevant change has been made.

  6. Compile the site but this time with the variable set. No frontend files should be compiled.

    NANOC_ENV=skip_frontend make compile
  7. Make a Markdown change again and compile once more with the variable set. No frontend files are compiled.

Note: You can follow the same steps by using make live instead of make compile as well.

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