Register icons in bundle manifest

I noticed Warren has the following in Iconoir package:

In an extension project using Umbraco Extension Template I have the following, which works as well in bundle.manifests.ts:

import { manifests as entrypoints } from "./entrypoints/manifest.js";
import { manifests as dashboards } from "./dashboards/manifest.js";
import { manifests as propertyEditors } from "./property-editors/manifests.js";
import { manifests as customViews } from "./custom-views/manifest.js";
import { manifests as iconPackManifests } from './icons/manifests';

// Job of the bundle is to collate all the manifests from different parts of the extension and load other manifests
// We load this bundle from umbraco-package.json
export const manifests: Array<UmbExtensionManifest> = [
  ...entrypoints,
  ...dashboards,
  ...propertyEditors,
  ...customViews,
  ...iconPackManifests
];

Is there a diference of this approaches or is this the recommended way to register icons in the bundle? Perhaps this Umbraco Extension Template should include a custom icon in the example dashboard? :slight_smile:

1 Like

No, you are essentially doing the same thing. The method registerMany literally loops through the extensions and registers them one by one.

Here’s an excerpt from the backoffice source:

	registerMany(manifests: Array<ManifestTypes | ManifestKind<ManifestTypes>>): void {
		manifests.forEach((manifest) => this.register(manifest));
	}
1 Like

I may add, there is a tiny little difference. But generally, what Jacobs says it is the same!

The difference is only important if you are doing a package that others might use in their projects.
So it’s preferable to use the bundle, The system understands the bundle. This means the system can unregister the bundle, and then all inner manifests of it will be unregistered as well.

The only current known use-case is that if you build a Package that ships things as bundles, the project that uses that package can exclude the specific bundle and be sure that all of its content is taken out. (Because the bundle was maybe registered slightly before the exclusion took place)

1 Like

Thanks for the eloboration and the insider knowledge :grinning_face_with_smiling_eyes:

Some may prefer to separate the extensions as separate packages (perhaps custom icons used in each package, e.g. as addon packages like Umbraco Forms and Umbraco Engage) and of couse depends on the complexity of the project.

In this project to extend a bit of the backoffice UI, it seems straightforward to use the bundle manifest :upside_down_face:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.