Skip to content
Draft
7 changes: 5 additions & 2 deletions site/src/assets/stackblitz.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ const CONFIG = {
cssCdn: '__CSS_CDN__',
cssBootstrapCdn: '__CSS_BOOTSTRAP_CDN__',
jsBundleCdn: '__JS_BUNDLE_CDN__',
docsVersion: '__DOCS_VERSION__'
docsVersion: '__DOCS_VERSION__',
brand: '__BRAND__'
}

// Open in StackBlitz logic
Expand All @@ -40,19 +41,21 @@ document.querySelectorAll('.btn-edit').forEach(btn => {
})

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/`

const indexHtml = `<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<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">

Copilot AI Apr 10, 2026

Copy link

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
hannahiss marked this conversation as resolved.
Outdated
<title>OUDS Web Example</title>
<${'script'} defer src="${CONFIG.jsBundleCdn}"></${'script'}>
</head>
<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()}

<!-- End Example Code -->
</body>
</html>`
Expand Down
1 change: 1 addition & 0 deletions site/src/plugins/stackblitz-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export function stackblitzPlugin() {
.replace(/__CSS_BOOTSTRAP_CDN__/g, config.cdn.css_bootstrap)
.replace(/__JS_BUNDLE_CDN__/g, config.cdn.js_bundle)
.replace(/__DOCS_VERSION__/g, config.docs_version)
.replace(/__BRAND__/g, config.brand)
}

return code
Expand Down
Loading