Skip to content

figma connect preview and batch template files don't play along #410

Description

@fernandofranca

We use batch template files for connecting our components and the CLI preview command seems not to be playing along when a component is specified.

✅ This runs fine:

npx figma connect preview -c ./config/figma-web-components-batch.config.json

This fails however:

npx figma connect preview dist/pie-notification.figma.batch.js -c ./config/figma-web-components-batch.config.json

Despite dist/pie-notification.figma.batch.js being the same file path set as templateFile in the figma.batch.json file, it always fails

Why we use batch template files

We have several cases where a component in Figma had to be split into similar but distinct components sets as Designers felt needed, likely due limitations in Figma or other reasons.

This lead to a problem where the only solution was to use batch templates: the props from each shared component set (say modal has 4) are pretty much the same, however, in the CC template side it's necessary to know which of these sets is selected to set different props accordingly.

If you check components.figma.batch.json, there are several cases where multiple component sets URLs are assigned to one component, and each of these sets provide extra context thru some variable.

The same can't be achieved with the regular templates files setup.

Reproduction steps

Node and Yarn versions are pinned with Mise

yarn
cd configs/pie-code-connect
yarn build:web
npx figma connect preview dist/pie-notification.figma.batch.js -c ./config/figma-web-components-batch.config.json

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions