Is it possible to include graphics in the custom module?

I've built a custom module in java and created associated perspective graphics using designer.
Is there a way I can include my graphic files in the custom module? so that they get added to designer and runtime whenever I import my custom module into gateway.

I wanted to avoid building another module for perspective components where I need to write the typescript/JavaScript code for graphics which will make no use of designer.

Absolutely, you should be bundling your JavaScript and CSS with your module.

Check the SDK example out:

Basic steps:

  1. In your gateway hook register a resource folder by overriding getMountedResourceFolder().
  2. Create a set of BrowserResources for your components (see common/OneComponent.java in the example).
  3. Register the BrowserResources to your component with .setResources (see common/comp/Image.java in the example).

Exactly how you do this at build time is up to you. I’m not a fan of how the SDK examples do this, it’s over complicated and just kinda wrong (webpack is :face_vomiting: and the way the gradle tasks are configured is not a good practice).

My recommendation is to build a WebJar with your web resources, then have your gateway scope depend on the WebJar with modlImpl.

See my Embr project for an example: