Skip to content

Refactor handbook.js to generate-navigation-helpers.js

Derek Knox requested to merge 7633-handbook-navigation-helpers-refactor into master

Why is this change being made?

To help improve clarity around "handbook" specific JavaScript use and more general use. In this case, most "handbook" templates (as defined here) want the following:

  • table of contents generation
  • header linking + associated scroll behavior

Other templates, namely security.haml want this behavior too (and potentially others). By refactoring the file name, function names, and leveraging the promise API to enforce intentional sequence of function execution we add clarity of expectation in addition to reuse opportunity.

  • I initially considered breaking this script in to smaller files, but came to learn we don't leverage a bundler and this would result in more requests so I opted to just refactor for now.*

Author Checklist

  • Provided a concise title for the MR
  • Added a description to this MR explaining the reasons for the proposed change, per say-why-not-just-what
  • Assign this change to the correct DRI
    • If the change relates to any part of the project other than updates to content and/or data files (e.g. team.yml) please make sure to ping @gl-static-site-editor in a comment for a review and merge.
    • If the DRI for the page/s being updated isn't immediate clear, then assign it to your manager.
    • If your manager does not have merge rights, please ask someone to merge it AFTER it has been approved by your manager in #mr-buddies

For help with failing pipelines reach out in #mr-buddies in Slack

Edited by Derek Knox

Merge request reports