Open jongjunpark opened 3 months ago
Hey @jongjunpark,
Sorry for the confusion here, I can see that our README on the icon script is not very clear.
Your icon script should create a .figma.tsx file which contains figma.connect
calls for each icon, not call Code Connect directly. If you take a look in the example, you can see that it uses fs.writeFileSync
to create a file called icons.figma.tsx
which contains one figma.connect
call per icon, and you can then publish that generated file with the normal figma connect publish
workflow.
So the workflow is:
icons.figma.tsx
to diskfigma connect publish
to publish icons.figma.tsx
It's not possible to call figma.connect
with a template literal (or other dynamic approaches e.g. string concatentation) because of how Code Connect works under the hood – we don't execute the .figma.tsx
file, but instead parse it, which means we don't support all language features in it.
I'll ensure we update our README to make this flow clearer, let me know if you have any more isseus.
I am trying to connect icons at once using the
client
from @figma/code-connect. However, when I use a template literal (${foo}
) expression infigmaNodeUrl
, it causes an error. How can I insert thenode ID
into the URL using a template literal?I even discovered that in figma.connect, using "
https://figma
" in figmaNodeUrl doesn't cause an error, but simply changing the double quotes to backticks, like `text
`, results in an error.