Skip to content

feat: support component, variant and links for raw file#263

Open
amoshydra wants to merge 1 commit into
figma:mainfrom
amoshydra:frontmatter-for-raw-template
Open

feat: support component, variant and links for raw file#263
amoshydra wants to merge 1 commit into
figma:mainfrom
amoshydra:frontmatter-for-raw-template

Conversation

@amoshydra

@amoshydra amoshydra commented Mar 15, 2025

Copy link
Copy Markdown

Preface:

I have read the contributing guidelines

However, we are currently not accepting any PRs at this time.

Understood if the PR will be closed. I am creating this PR to share a code reference that supports the feature request highlighted in #262.

Summary

This PR will allow additional CodeConnectJSON attribute to be defined via frontmatter syntax in the raw file.

Currently it is limited to the following properties only:

  • url
  • component
  • variant
  • links

This PR will add yaml as a dependency

Usage

/*---
url: https://www.figma.com/file/your-file-id/Component?node-id=123
component: Button
variant:
  type: primary,
  has outline: true
links:
  - name: Awesome Document
    url: https://example.com
---*/

const figma = require('figma')
const instance = figma.selectedInstance

Frontmatter is wrapped in comment block

Syntax highlighting in VS Code will not work correctly out of the box with the original suggested usage in #262

image

After wrapping in a comment block (changed in https://github.com/figma/code-connect/compare/8e2607ac42afbf6a47c86cc64310afb86872e752..b0088e339e6e613c65bbe3f5bbbc6aad7df534ef)

image


close #262

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

Labels

None yet

1 participant