Text asset
  • 08 Mar 2023
  • 1 Minute to read
  • Contributors
  • Dark
    Light

Text asset

  • Dark
    Light

Article Summary

A text asset can contain large amounts of textual data.
You can work with its text content in a configurator (unlike the contents of a file asset).
As such, it's useful as a container for e.g. HTML print templates or SVG images (if you want to process them as text).

How to create a text asset

You have two options to create a text asset: you can either create an empty text asset or upload a text file.

Create empty text asset

  1. Click on the (+) button to create a new empty text asset
    empty-text.png

  2. Select a name, folder, format and click on Create asset.
    empty-text-dialog.png

Upload existing text file

  1. Click on Upload Files to upload one or more text files.
    upload-text.png

  2. Select the Text asset type. Keep in mind, a text file can also be uploaded as file asset.
    upload-text-dialog.png

Change text content

After creating or uploading a text asset, it is possible to change its content. Similar to other assets, you can also rename, copy, move and delete a text asset.

image.png

How to use a text asset

A text asset can be used in the configurator. For this, initially assign the asset bundle which contains your text asset to your configurator as described here.

Keep in mind that retrieving text content requires time.
This means, loading a large number of texts can slow down your configurator – so only use what you really need.

URL

You can get the URL of the text content in the configurator with the following hive rule:

MyBundle.MyText.url

Content

Retrieve the content of a text asset in the configurator with the following hive rule:

MyBundle.MyText.getText()

Supported formats

Currently, text assets support the file formats listed below.
The asset editor provides appropriate syntax highlighting and error notifications for them.
If you create an empty text asset, the format must be explicitly defined. If you upload a text file, the format is detected based on its file extension.

Note that the format cannot be changed in a subsequent step.
For this, please re-upload the file with the desired file extension or create an empty text asset.

Info

The format has no significant impact for the usage in the configurator.
The content of a text assest will always be a text in hive.

FormatMaximum size
txt512 KB
svg512 KB
html512 KB
xml512 KB
json512 KB

Was this article helpful?

What's Next