# Create a new application by executing:
npm install -g @angular/cli
ng new my-app
✔ Do you want to create a 'zoneless' application without zone.js (Developer Preview)? "Yes"
✔ Which stylesheet format would you like to use? "CSS"
✔ Do you want to enable Server-Side Rendering (SSR) and Static Site Generation (SSG/Prerendering)? "No"
npm install @porsche-design-system/components-angular
PorscheDesignSystemModule to the imports array of your @Component or @NgModule declaration.// src/app/app.ts
import { Component, signal } from '@angular/core';
import { RouterOutlet } from '@angular/router';
+ import { PorscheDesignSystemModule } from '@porsche-design-system/components-angular';
@Component({
selector: 'app-root',
+ imports: [RouterOutlet, PorscheDesignSystemModule],
templateUrl: './app.html',
styleUrl: './app.css',
})
export class App {
protected readonly title = signal('angular');
}
/cn import instead, see
/* src/styles.css */
+ @import '@porsche-design-system/components-angular/index.css';
:defined.hydrated:defined
pseudo-class, scope the style to specific tags instead (e.g., :is(p-button, p-accordion, …):not(:defined)). See
/* src/styles.css */
@import '@porsche-design-system/components-angular/index.css';
+ :is(p-accordion, p-banner, p-button, …):not(:defined) {
+ visibility: hidden;
+ }
<head> section of your HTML to preload fonts, icons, and component chunks.prebuild.mjs file in your project root directory.// prebuild.mjs
import { readFileSync, mkdirSync, writeFileSync } from 'node:fs';
import {
getComponentChunkLinks,
getFontLinks,
getIconLinks,
getMetaTagsAndIconLinks,
} from '@porsche-design-system/components-angular/partials';
const headPartials = [
// preloads fonts
getFontLinks(),
// preloads icons
getIconLinks(),
// preloads components
getComponentChunkLinks(),
// injects favicon, apple touch icons, android touch icons, etc.
getMetaTagsAndIconLinks({ appTitle: 'Porsche' }),
].join('\n');
const html = readFileSync('src/index.html', 'utf-8');
const transformed = html.replace(/<\/head>/, `${headPartials}\n$&`);
mkdirSync('.generated', { recursive: true });
writeFileSync('.generated/index.html', transformed);
console.log('Generated .generated/index.html with PDS partials.');
package.json."scripts": {
"ng": "ng",
+ "prebuild": "node prebuild.mjs",
+ "start": "npm run prebuild && ng serve",
+ "build": "npm run prebuild && ng build",
+ "watch": "npm run prebuild && ng build --watch --configuration development",
"test": "ng test",
},
angular.json."architect": {
"build": {
"builder": "@angular/build:application",
"options": {
+ "index": ".generated/index.html",
"browser": "src/main.ts",
"tsConfig": "tsconfig.app.json",
…
},
},
},
npm install tailwindcss @tailwindcss/postcss postcss
.postcssrc.json file in your project root directory.// .postcssrc.json
{
"plugins": {
"@tailwindcss/postcss": {}
}
}
/* src/styles.css */
@import '@porsche-design-system/components-angular/index.css';
+ @import 'tailwindcss';
+ @import '@porsche-design-system/components-angular/tailwindcss';
<p-wordmark></p-wordmark>) with some Tailwind CSS styles. Then, run
npm run start and verify that the component and styles display correctly.// src/app/app.html
<div class="grid justify-items-center gap-fluid-md m-static-lg p-fluid-lg bg-surface rounded-lg">
<p-wordmark></p-wordmark>
<h1 class="prose-heading-4xl">Porsche Design System</h1>
</div>
<div class="…">…</div>
