lyne-helper-figma-api

1.1.6 • Public • Published

Build Status semantic-release GitHub tag (latest SemVer)

Lyne Helper Figma API

Helper methods to simplify requests to the Figma API.

Usage

Installation

Install the Figma API Helper with the following command:

npm install --save-dev lyne-helper-figma-api

Require

const figma = require('lyne-helper-figma-api');

Fetch document

figma.document('https://api.figma.com/v1/files/YOUR_FILE_ID', 'YOUR_FIGMA TOKEN')
  .then((document) => {
    console.log(document);
  })
  .catch((error) => {
    console.log(error);
  });

Get pages of a document

figma.pages() accepts 2 arguments:

figmaDocument: the data returned from figma.document()

ignorePattern: pages that include the ignorePattern in their name will be ignored and not returned.

const pages = figma.pages(figmaDocument, ignorePattern);

Get frames of a page

figma.frames() accepts 2 arguments:

page: one of the pages returned from figma.pages()

ignorePattern: frames that include the ignorePattern in their name will be ignored and not returned.

const page = pages[0];
const frames = figma.frames(page, ignorePattern);

Development

Conventional Commits

Please follow the Conventional Commits specification to make sure we can automatically determine the next release version if necessary.

Deployment

The package is automatically build and published to npm via Travis CI as soon as pushed to master.

Readme

Keywords

none

Package Sidebar

Install

npm i lyne-helper-figma-api

Weekly Downloads

0

Version

1.1.6

License

ISC

Unpacked Size

39.9 kB

Total Files

3

Last publish

Collaborators

  • lyne-design-system