I actually migrated my Angular app from 17 to 18. I use PrimeNG, but I have some errors with the PrimeNG style.
In PrimeNG 18, primeng/resources/primeng.css is not found, so I don't know how I can resolve this.
In my style.scss, I have this:
@import "./assets/theme/themes/posm/aura-light/blue/theme.scss";
@import "primeng/resources/primeng.css";
@import "./assets/icons/menu-icons.scss";
@import "./assets/icons/report-menu-icons.scss";
@import "primeicons/primeicons.css";
@import "../node_modules/quill/dist/quill.core.css";
@import "../node_modules/quill/dist/quill.snow.css";
@layer primeng;
According to the Migration guide to PrimeNG v18 document (SASS Theme section),
The styled mode theming has been reimplemented from scratch based on an all-new architecture. The
theme.cssand theprimeng/resourcesdo not exist anymore, so any imports of these assets needs to be removed. If you had a custom theme for v17, the theme needs to be recreated using the new APIs. See the customization section at styled mode for details.
Remove @import "primeng/resources/primeng.css"; from your .scss stylesheet.
And you have to initialize the theme via Configuration API as below
Initialize theme
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
import { ApplicationConfig } from '@angular/core';
import { providePrimeNG } from 'primeng/config';
import Aura from '@primeng/themes/aura';
export const appConfig: ApplicationConfig = {
providers: [
provideAnimationsAsync(),
providePrimeNG({
theme: { preset: Aura },
}),
],
};
Initialize theme with customize on existing preset
import { definePreset } from '@primeng/themes';
import Aura from '@primeng/themes/aura';
const MyPreset = definePreset(Aura, {
// Customizations
});
export MyPreset;
import { ApplicationConfig } from '@angular/core';
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
import { providePrimeNG } from 'primeng/config';
import MyPreset from './mypreset';
export const appConfig: ApplicationConfig = {
providers: [
provideAnimationsAsync(),
providePrimeNG({
theme: {
preset: MyPreset
}
})
]
};