C3 AI Documentation Home

Use static assets in your application

Oftentimes, applications expect to be able to use specific images or other assets that are not expected to change. In this case, it's easiest for these assets to be stored directly in the application package for easy retrieval.

This document will walk through the example where someone wants to add logo.svg to their new package demoPkg, for use in both UI Framework curated components and their own custom components.

Placing the asset

Static assets, including images, need to be stored at the path demoPkg/ui/content. Importantly, files stored here will be served without any processing, so it's best used for completely static assets such as images, fonts, pdfs, etc. Storing in that directory allows the application to properly store the files, so they can be retrieved from https://CLUSTER/ENV/APP/FILE. To make organization easier, sub-directories can also be made within content, and these sub-directories are then appended to the retrieval URL. For example, logo.svg will be used as an image asset, so storing it in demoPkg/ui/content/assets/images will result in its retrieval URL being https://CLUSTER/ENV/APP/assets/images/logo.svg. For more information about how to structure your UI files, please check UI directory structure.

Using the asset

For more information on how to reference an image, please see Referencing URLs.

Was this page helpful?