cdn.ui.porsche.**com**) is configured to automatically forward those
requests to a CDN hosted in China (cdn.ui.porsche.**cn**), which then serves the response. Why? Because local law
requires it. This approach provides an easy way to use Porsche Design System assets without having to worry about
performance in China or the rest of the world, and it works with zero configuration.PORSCHE_DESIGN_SYSTEM_CDN was introduced which needs to be defined before
initializing the Porsche Design System.Attention
auto (default - using RoW CDN and redirects to Chinese CDN automatically when necessary)cn (forces using Chinese CDN directly) This gives the possibility for the consuming application to have either two
dedicated builds for their application, one for China and one for RoW (rest of world) or following the build once,
deploy many principle, it can be configured at start-up time.PORSCHE_DESIGN_SYSTEM_CDN isn't very nice and won't work in a SSR
context, the porscheDesignSystem.load() function accepts a cdn: 'auto' | 'cn' option which will then set the
PORSCHE_DESIGN_SYSTEM_CDN for backwards compatibility and therefore affecting other micro frontends within the same
website or app.PorscheDesignSystemModule.load({ cdn: 'cn' })<PorscheDesignSystemProvider cdn="cn" /><PorscheDesignSystemProvider cdn="cn" /><!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Porsche Design System</title>
<script type="text/javascript" src="path-to-porsche-design-system.js"></script>
</head>
<body>
<script>
porscheDesignSystem.load({ cdn: 'cn' });
</script>
</body>
</html>
import { BrowserModule } from '@angular/platform-browser';
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { PorscheDesignSystemModule } from '@porsche-design-system/components-angular';
import { AppComponent } from './app.component';
@NgModule({
declarations: [],
imports: [BrowserModule, PorscheDesignSystemModule.load({ cdn: 'cn' })],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
bootstrap: [AppComponent],
})
export class AppModule {}
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import { BrowserRouter } from 'react-router-dom';
import { PorscheDesignSystemProvider } from '@porsche-design-system/components-react';
import { App } from './App';
const root = createRoot(document.getElementById('root')!);
root.render(
<StrictMode>
<BrowserRouter>
<PorscheDesignSystemProvider cdn="cn">
<App />
</PorscheDesignSystemProvider>
</BrowserRouter>
</StrictMode>
);
<script setup lang="ts">
import { PorscheDesignSystemProvider } from '@porsche-design-system/components-vue';
</script>
<template>
<PorscheDesignSystemProvider cdn="cn">
<RouterView />
</PorscheDesignSystemProvider>
</template>
/cn import needs to be used, e.g.:- @import '@porsche-design-system/components-{js|angular|react|vue}';
+ @import '@porsche-design-system/components-{js|angular|react|vue}/cn';
// Alternative: If your bundler requires an explicit .css extension, use this path instead
- @import '@porsche-design-system/components-{js|angular|react|vue}/index.css';
+ @import '@porsche-design-system/components-{js|angular|react|vue}/cn/index.css';
@porsche-design-system/components-{js|angular|react|vue}/partials packages have
an option { cdn: 'auto' | 'cn' } to force preloading assets from Chinese CDN directly, e.g.:<head>
<%= require('@porsche-design-system/components-{js|angular|react|vue}/partials').getFontFaceStylesheet({ cdn: 'cn' })
%>
</head>
