Fix CDN imports, Safari nav, DOM timing, and dev build pipeline#127
Merged
kallewesterling merged 15 commits intomainfrom Apr 27, 2026
Merged
Fix CDN imports, Safari nav, DOM timing, and dev build pipeline#127kallewesterling merged 15 commits intomainfrom
kallewesterling merged 15 commits intomainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR resolves a series of cascading bugs that prevented the dev bundle from working, plus a Safari-specific navigation regression discovered in the process.
CDN imports → npm packages
import()calls for@tsparticles/confettiandshikiwith proper npm dependencies. esbuild's IIFE output converts allimport()torequire()shims, so CDN URL imports threwDynamic require of "URL" is not supportedat runtime; CSPunsafe-evalalso blocked theFunction()workaround.shiki/core, per-language.mjsfiles) instead of the fullshikibundle, keeping the output at ~2 MB instead of ~9.9 MB.generate_language_file.jsto scan lesson HTML for language identifiers and emitproduction/data/languages.jsonso the language list stays in sync with content.DOM timing (esbuild IIFE runs before DOMContentLoaded)
CG.dom,CG.page, andCG.envto getter accessors so DOM queries only run at call time, not at module parse time.DOMContentLoadedhandler into three separate try/catch blocks (preRoute,route,postRoute) so a failure in one phase doesn't silently swallow the others.showBody()is called unconditionally afterward to prevent a permanently hidden page.logger.warntologger.errorwith a full page-state dump.Safari/Dia navigation fix
#left-nav-buttonexists in Chrome's DOM atDOMContentLoadedbut not in Safari, so our custom toggle button only fires in Safari. Theon:handler was nested insidearia:in theel()call, producingaria-on=\"[object Object]\"in the HTML instead of attaching a click listener — fixed by movingon:to the top level.left: -320pxon#lp-left-nav.cbp-spmenu:not(.cbp-spmenu-open)with higher specificity than our rule. Addedleft: 0 !importantto our base#lp-left-navrule so thetransform-based open/close animation is not overridden.setNavOpen(open)which mirrorscbp-spmenu-openon bothbody(for our CSS) and#lp-left-nav(for Skilljar's CSS), and persists the state tolocalStorage.lessonNavStateOpenso the user's preference survives page loads in any browser.hideCompletionevent listenerhideCompletion()was passingon: { transitionend: … }tosetStyle(), which does not handle event listeners — thetransitionendcallback was never attached. Replaced with nativeaddEventListener/removeEventListenerplus a 300 ms safety timeout.Dev build pipeline
.github/workflows/sync-dev-gcs.yaml— triggers on pushes todevwith changes underproduction/**orfonts/**, builds without minification, and syncs only togs://chainguard-courses-theme/dev/dist/.build-dev.mjswhich injects the short commit SHA as a/* build: <hash> */banner in bothbundle.jsandbundle.css, making it easy to verify which bundle is loaded in the browser without checking filenames.Test plan
localStorage.lessonNavStateOpen; defaults to open)/* build: <hash> */banner appears on line 1 of the deployedbundle.jsandbundle.cssnpm run build) still lints and minifies cleanly