Skip to content

refactor: unify deploy base path handling#2557

Open
joyenjoyer wants to merge 1 commit into
masterfrom
tokens-preview-base-path
Open

refactor: unify deploy base path handling#2557
joyenjoyer wants to merge 1 commit into
masterfrom
tokens-preview-base-path

Conversation

@joyenjoyer
Copy link
Copy Markdown
Contributor

@joyenjoyer joyenjoyer commented May 12, 2026

This change is needed to be able to host PR previews on Github pages of instructure-design-tokens repo.

Unify docs-app deploy base path handling

Make PUBLIC_PATH (env var → webpack output.publicPath) the single source of truth for "where this build lives" and thread it through every layer:

  • webpack.config.mjs — resolve PUBLIC_PATH once and pass it to both output.publicPath and HtmlWebpackPlugin's templateParameters.
  • index.html<base href> and the inline 404 SPA-redirect script both read the template parameter; the redirect is now generic instead of pattern-matching pr-preview/latest.
  • navigationUtils.ts — new getDeployBase() reads __webpack_public_path__ at runtime. parseCurrentUrl strips it before parsing the in-app route; getAssetBasePath returns it directly. Renamed
    prPrefixbasePrefix and de-duplicated a double parseCurrentUrl() call in buildUrl.

No behavior change for current instructure.design deploys. Unlocks hosting the docs-app at any base path — other repos (e.g. design-tokens previews) or arbitrary sub-hosts — by setting PUBLIC_PATH at
build time.

@github-actions
Copy link
Copy Markdown

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://instructure.design/pr-preview/pr-2557/

Built to branch gh-pages at 2026-05-12 14:13 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

github-actions Bot pushed a commit that referenced this pull request May 12, 2026
@github-actions
Copy link
Copy Markdown

Visual regression report

No changes.

Status Count
Unchanged 32
Changed 0
New 0
Removed 0

📊 View full report

Baselines come from the visual-baselines branch. They refresh on every merge to master.

@joyenjoyer joyenjoyer self-assigned this May 12, 2026
@joyenjoyer joyenjoyer requested review from HerrTopi and balzss May 12, 2026 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant