Skip to content

Theemo / @theemo/figma / Plugin

Interface: Plugin ​

Defined in: figma/src/plugin.ts:11

A Plugin which can be used to help parse tokens when being used in the figmaReader()

See ​

Plugin Documentation

Methods ​

getPluginData()? ​

ts
optional getPluginData(): string;

Defined in: figma/src/plugin.ts:32

Figma plugins can store data and make it accessible through the REST API.

Your reader plugin has the chance to read that information here.

The value here will be appended when making a GET request to Figma. Such as:

GET /v1/files/:key?plugin_data=S{YOUR_PLUGIN_DATA}

Returns ​

string

See ​

Figma REST API


getProperties()? ​

ts
optional getProperties(token): Partial<Token>;

Defined in: figma/src/plugin.ts:42

Any additional properties to a token, that your plugin is fetching can be attached to the token here

Parameters ​

ParameterTypeDescription
tokenFigmaTokenthe FigmaToken

Returns ​

Partial<Token>

any additional token properties from your plugin

See ​

FigmaParserConfig.getProperties


parse()? ​

ts
optional parse(file, fileId): TokenCollection<FigmaToken<"unknown">>;

Defined in: figma/src/plugin.ts:50

Your plugin can parse a source file

Parameters ​

ParameterTypeDescription
fileGetFileResultthe entire file itself
fileIdstringthe fileId

Returns ​

TokenCollection<FigmaToken<"unknown">>


resolve()? ​

ts
optional resolve(token, tokens): FigmaToken;

Defined in: figma/src/plugin.ts:59

Resolving tokens, in case your plugin stores information needed to resolve tokens. Use this method to support resolving tokens.

Parameters ​

ParameterTypeDescription
tokenFigmaTokenthe token to be resolved
tokensTokenCollection<FigmaToken<"unknown">>all tokens

Returns ​

FigmaToken


setup()? ​

ts
optional setup(config): void | Promise<void>;

Defined in: figma/src/plugin.ts:17

Any setup step required for your plugin.

Parameters ​

ParameterTypeDescription
configFigmaParserConfigWithDefaultsReceivse the Figma Reader Parser config with defaults

Returns ​

void | Promise<void>