Install the CLI and wire icon registration. See also Usage.
npm install --save-dev @rdlabo/ionic-angular-collect-iconsThe generated application code imports the package's browser runtime, so build environments must install development dependencies before compiling the application. The runtime is then bundled into the application output.
npx @rdlabo/ionic-angular-collect-icons --initialize truenpx @rdlabo/ionic-angular-collect-iconsThis will generate src/use-icons.ts.
+ import { initializeIonicons } from '@rdlabo/ionic-angular-collect-icons/runtime';
+ import * as useIcons from './use-icons';
if (environment.production) {
enableProdMode();
}
+ void initializeIonicons(useIcons);initializeIonicons registers the collected icons synchronously. Angular's
isDevMode() then enables the complete catalog from an isolated lazy bundle in
development. Production starts without downloading that catalog bundle.
When an interactive collector run detects the ternary initializer emitted by
older releases, it asks whether to migrate it. The default answer is Yes.
Selecting No leaves the initializer unchanged. Existing custom
addIcons(...) calls are also left unchanged. See
Migration for preview,
non-interactive, and matching details.
@Component(/* ... */)
export class ExampleComponent {
constructor() {
- addIcons(useIcons);
}
}