Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

PNG Profile

Purpose

The profile is designed for importing PNG assets from Figma.

The asset import process consists of the following stages:

  1. Fetch Figma remote: REST API reference
  2. Locate the node ID by the specified name
  3. Request PNG export from Figma using the node ID: REST API reference
  4. Download the exported PNG file

Complete Configuration in .figtree.toml

[profiles.png]
# 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"
# Specifies which variants to use. Only the listed keys will be processed.
# Can be overridden in .fig.toml for each resource
variants.use = ["L", "M", "S"]
# Available variants
# output_name - filename for the exported file
# figma_name - node name in Figma to look for
variants.L = { output_name = "{base}L", figma_name = "{base}_24" }
variants.M = { output_name = "{base}M", figma_name = "{base}_20" }
variants.S = { output_name = "{base}S", figma_name = "{base}_16" }
variants.XS = { output_name = "{base}XS", figma_name = "{base}_12" }
# 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