GithubHelp home page GithubHelp logo

louizo / figma-js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jemgold/figma-js

0.0 0.0 0.0 183 KB

Little wrapper (+ types) for the Figma API

Home Page: https://jongold.github.io/figma-js/

License: MIT License

TypeScript 100.00%

figma-js's Introduction

Figma.js

A simple wrapper for the Figma API.

Cool projects using this:

Usage

Full documentation is available on the web and most everything is typed with TypeScript.

Creating a client

Quickest start is to grab a personal access token from your Figma account settings page

import * as Figma from 'figma-js';

const token = '12345';

const client = Figma.Client({
  personalAccessToken: token
});

Or if you're building an app with OAuth authentication, after you get back the OAuth access token…

import * as Figma from 'figma-js';

const token = '12345';

const client = Figma.Client({
  accessToken: token
});

Or if you need to use a https proxy agent:

import * as Figma from 'figma-js';
import { HttpsProxyAgent } from 'https-proxy-agent';

const token = '12345';
const proxyAgent = new HttpsProxyAgent(process.env.https_proxy);

const client = Figma.Client({
  accessToken: token,
  httpsAgent: proxyAgent,
  proxy: false
});

Doing cool things

Once you have instantiated a client, have fun!

client.file('file-id').then(({ data }) => {
  console.log(data);
});

Just reusing types

All of the types in the Figma file format / API are exported.

import * as Figma from 'figma-js';

const textNode: Figma.Text = {
  // … this should autocomplete if your editor is set up for it!
};

Contributing

We used the typescript-starter repo for this - refer to its README for more detailed instructions.

Helpful development commands:

yarn watch
yarn docs
yarn docs:publish

Contributions welcomed

Committing

yarn global add commitizen

# instead of git commit

git cz

Contributors

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.