Skip to content

Skip unneeded search bundles when compiling JavaScript

What does this MR do and why?

The site only runs one search backend at once, as determined by the SEARCH_BACKEND environment variable. By dropping files related to the unused search backend, we can reduce compile time on CI by a few minutes.

Closes #1597 (closed)

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 this branch
  3. Compile the site with Lunr: SEARCH_BACKEND="lunr" make compile
  4. In the Yarn output, right after INFO: Compiling JavaScript..., you should see lunrsearch.js, but not google.js, google_results.js, or google_search_api.js
  5. View the site and verify Lunr search works as expected: bundle exec nanoc view
  6. Compile the site with Google: make compile
  7. Check the Yarn output and verify the google*.js files are processed, but not lunrsearch.js
  8. View the site and verify Google search works as expected: bundle exec nanoc view

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.

Closes #1597 (closed)

Edited by Sarah German

Merge request reports

Loading