Skip to content

[OUDS] Add sprite to Stackblitz example to have icons#3464

Draft
hannahiss wants to merge 11 commits intoouds/mainfrom
ouds/main-his-svg-stackblitz
Draft

[OUDS] Add sprite to Stackblitz example to have icons#3464
hannahiss wants to merge 11 commits intoouds/mainfrom
ouds/main-his-svg-stackblitz

Conversation

@hannahiss
Copy link
Copy Markdown
Member

@hannahiss hannahiss commented Mar 19, 2026

Related issues

Closes #3038

Description

Checklists

Progression (for Core Team only)

Live previews

@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 19, 2026

Deploy Preview for boosted ready!

Name Link
🔨 Latest commit 6b7fe5c
🔍 Latest deploy log https://app.netlify.com/projects/boosted/deploys/69e0e253b4ca35000843f06d
😎 Deploy Preview https://deploy-preview-3464--boosted.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@hannahiss hannahiss marked this pull request as ready for review March 23, 2026 10:32
@boosted-bot boosted-bot moved this from In Progress / Draft to Need Dev Review in 🟣 [Orange-Boosted-Bootstrap] PRs Board Mar 23, 2026
Copy link
Copy Markdown
Member

@louismaximepiton louismaximepiton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just asking if we should have the brand in this file

<body class="p-2xlarge m-none border-none ${classes}">
<!-- Example Code -->
${htmlSnippet.trimStart().replace(/^/gm, ' ').replace(/^ {4}$/gm, '').trimEnd()}
${htmlSnippet.trimStart().replace(/^/gm, ' ').replace(/^ {4}$/gm, '').replaceAll(/xlink:href="\/.+\/ouds-web-sprite\.svg/g, `xlink:href="${spriteUrl}`).trimEnd()}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
${htmlSnippet.trimStart().replace(/^/gm, ' ').replace(/^ {4}$/gm, '').replaceAll(/xlink:href="\/.+\/ouds-web-sprite\.svg/g, `xlink:href="${spriteUrl}`).trimEnd()}
${htmlSnippet.trimStart().replace(/^/gm, ' ').replace(/^ {4}$/gm, '').replaceAll(/xlink:href="\//g, `xlink:href="${spriteUrl}`).trimEnd()}

})

const openOUDSWebSnippet = (htmlSnippet, jsSnippet, classes, cssBootstrap) => {
const spriteUrl = `https://web.unified-design-system.orange.com/${CONFIG.brand}/docs/${CONFIG.docsVersion}/assets/img/ouds-web-sprite.svg`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we don't need BRAND

Suggested change
const spriteUrl = `https://web.unified-design-system.orange.com/${CONFIG.brand}/docs/${CONFIG.docsVersion}/assets/img/ouds-web-sprite.svg`
const spriteUrl = `https://web.unified-design-system.orange.com/`

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds OUDS Web SVG sprite support to StackBlitz “Edit on StackBlitz” examples so icon-based snippets render correctly when opened outside the docs site (addresses missing sprite issue in #3038).

Changes:

  • Injects brand into the StackBlitz asset config via the Vite placeholder replacer.
  • Builds a brand/version-specific sprite URL in the StackBlitz template and preloads it.
  • Rewrites xlink:href sprite references in example HTML to point to the absolute sprite URL.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
site/src/plugins/stackblitz-plugin.js Adds __BRAND__ placeholder replacement so StackBlitz JS can construct brand-scoped asset URLs.
site/src/assets/stackblitz.js Constructs sprite URL, preloads it, and rewrites snippet sprite references so icons work in StackBlitz.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread site/src/assets/stackblitz.js Outdated
Comment on lines +50 to +52
<link href="${cssBootstrap ? CONFIG.cssBootstrapCdn : CONFIG.cssCdn}" rel="stylesheet" />
<link href="https://web.unified-design-system.orange.com/docs/${CONFIG.docsVersion}/assets/css/docs.css" rel="stylesheet" />
<link rel="preload" href="${spriteUrl}" as="image" type="image/svg+xml">
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs CSS URL here doesn’t include the brand segment, but the site’s versioned asset paths are brand-scoped (e.g., getVersionedDocsPath() returns /${brand}/docs/${docs_version}/...). For non-default brands (and to stay consistent with spriteUrl just below), this will likely 404 or load the wrong styling. Consider including CONFIG.brand in the docs.css URL (or deriving the base from config) so StackBlitz examples load the correct assets for the active brand.

Copilot uses AI. Check for mistakes.
Comment thread site/src/assets/stackblitz.js Outdated
@louismaximepiton
Copy link
Copy Markdown
Member

Since it doesn't work right now, I'm updating this PR to draft. We might study the way where ouds-web-sprite is added to the html directly.

@louismaximepiton louismaximepiton marked this pull request as draft April 17, 2026 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Need Dev Review

Development

Successfully merging this pull request may close these issues.

4 participants