Assets builder
Learn how to use the VTEX IO Assets builder.
The assets builder manages assets within VTEX IO apps. It does this by collecting all asset paths used and uploading them to the File Manager service.
The File Manager service manages store files and their respective URLs, translating asset paths and exporting immutable URLs for proper rendering of block assets.
For more information about using this builder in a Store Theme app, see Using the
assetsbuilder.
Folder structure
An app that uses the assets builder has a folder named \assets in its root directory. The directory structure may vary depending on specific project settings.
You can add any image extension, such as .jpeg, .png, and .gif, as well as store font files (.ttfor .woff) to later customize store typography.
Assets can be added directly to the /assets folder, or for better organization, subfolders can be created within it, as illustrated below:
_10assets_10 ┣ 📂 fonts_10 ┗ 📄 {FileName}.woff_10 ┣ 📄 {FileName}.jpeg_10 ┣ 📄 {FileName}.png
Usage
To use the assets builder in your app, follow these steps:
-
Add the
assetsbuilder to your app’s builder list in themanifest.jsonfile, as shown below:_10"builders": {_10"assets": "0.x"_10} -
In the root directory of your app, create an
/assetsfolder to manage store assets. -
Add the asset files to the
/assetsfolder. Add subfolders to organize the files as needed. -
To use the stored assets within your app, use the asset path as the value of a given parameter. Note that if you have structured subfolders within the
assetsfolder, you need to include the folder hierarchy in the asset path. For example:assets/fonts/{FileName}.woff.
Use case examples
As an example, check the folder structure of this builder in the B2B Theme app:
_10assets_10 ┣ 📂 fonts_10 ┗ 📄 {FileName}.woff_10 ┣ 📂 icons_10 ┗ 📄 {FileName}.svg_10 ┗ 📄 {FileName}.svg_10┗ 📄 {FileName}.jpg
- The
fontsfolder contains.wofffiles, which are web fonts. - The
iconsfolder holds.svgfiles, which may be icons, logos, graphics, and other vector images.