Skip to content

Theemo / @theemo/figma / Plugin

Interface: Plugin

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

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

Source

packages/@theemo/figma/src/plugin.ts:32


getProperties()?

ts
optional getProperties(token): Partial<Token<"unknown">>

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

Parameters

ParameterTypeDescription
tokenFigmaToken<"unknown">the FigmaToken

Returns

Partial<Token<"unknown">>

any additional token properties from your plugin

See

FigmaParserConfig.getProperties

Source

packages/@theemo/figma/src/plugin.ts:42


parse()?

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

Your plugin can parse a source file

Parameters

ParameterTypeDescription
fileFilethe entire file itself
fileIdstringthe fileId

Returns

TokenCollection<FigmaToken<"unknown">>

Source

packages/@theemo/figma/src/plugin.ts:50


resolve()?

ts
optional resolve(token, tokens): FigmaToken<"unknown">

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

Parameters

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

Returns

FigmaToken<"unknown">

Source

packages/@theemo/figma/src/plugin.ts:59


setup()?

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

Any setup step required for your plugin.

Parameters

ParameterTypeDescription
configFigmaParserConfigWithDefaultsReceivse the Figma Reader Parser config with defaults

Returns

void | Promise<void>

Source

packages/@theemo/figma/src/plugin.ts:17