WEBP profile
Purpose
The profile is designed for importing WEBP assets from Figma.
The asset import process consists of the following stages:
- Fetch Figma remote: REST API reference
- Locate the node ID by the specified name
- Request PDF export from Figma using the node ID: REST API reference
- Download the exported PNG file
- Convert the downloaded PNG to WEBP format (using
libwebp
)
Complete Configuration in .figtree.toml
[profiles.webp]
# ID from the [remotes] section.
# Uses the default remote if unspecified, but can reference any configured remote
remote = "some_remote_id"
# Export scale for the image from Figma (default: 1.0)
scale = 1.0
# Target directory for downloaded assets.
# Defaults to empty (root package directory where .fig.toml resides)
output_dir = "some_dir"
# Output quality for WEBP conversion (0-100)
# Defaults to 100 (lossless) - recommended value
quality = 100
# Specifies which variants to use. Only the listed keys will be processed.
# Can be overridden in .fig.toml for each resource
variants.use = ["1x", "2x", "3x"]
# Available variants
# output_name - filename for the exported file
# figma_name - node name in Figma to look for
variants.1x = { output_name = "{base}", figma_name = "{base}", scale = 1.0 }
variants.2x = { output_name = "{base}@2x", figma_name = "{base}", scale = 2.0 }
variants.3x = { output_name = "{base}@3x", figma_name = "{base}", scale = 3.0 }
# If true, the legacy resource loading method will be used.
# The new approach downloads the SVG source and renders the raster image locally.
# In most cases, this significantly speeds up the import process.
# This may not suit all use cases, so the feature can be disabled.
legacy_loader = false