Giter Site home page Giter Site logo

figma-api-exporter's Introduction

Figma API Exporter

Allows you to export assets from Figma files automatically and use it in your project.

Features:

  • download all components as SVGs from Figma file or Frame

Examples

const figmaApiExporter = require('figma-api-exporter').default;

const exporter = figmaApiExporter(YOUR_FIGMA_API_TOKEN);

exporter
  .getSvgs({
    fileId: YOUR_FIGMA_FILE_ID,
    canvas: 'Icons',
  })
  .then(svgsData =>
    exporter.downloadSvgs({
      saveDirectory: './svgsFiles',
      svgsData: svgsData.svgs,
      lastModified: svgsData.lastModified,
    })
  );

API

getSvgs

Function which fetches urls of component exports as svgs.

Arguments:

  • fileId (required) (string) - id of figma files you want to extract svgs from
  • canvas (optional) (string|function) - filter exported components by Page name, you can use a custom filter function with additional information about page
  • component (optional) (string|function) - filter by exported components by Component name, you can use a custom filter function with additional information about component

downloadSvgs

Function which downloads svg files to your directory. It checks Figma File modification date and component ids to find out if your local copy is up to date before downloading everything. You can replace this function with your own script.

Arguments:

  • saveDirectory (required) (string) - path to save svg files
  • svgsData (required) (array) - '.svgs' values returned from .getSvgs()
  • lastModified (required) (string) - .lastModified value returned from .getSvgs(), used to check if Figma file was modified and it should continue downloading
  • clearDirectory (optional) (boolean) (defaults to: false) - change to true if you want to clear the saveDirectory before downloading files, it comes handy when you want to delete old icons, which don't exist in Figma anymore

figma-api-exporter's People

Contributors

fallaciousreasoning avatar slawomirkolodziej avatar

Stargazers

Ivan avatar  avatar צעד אחד בכל פעם avatar Viyan.UX Engineer avatar Tony O'Connell avatar flumpus avatar Jakub Kozakiewicz avatar Sean P. Myrick V19.1.7.2 avatar  avatar Rodrigo Tello avatar Artur avatar Adriano Cahete avatar Martin Salo avatar hmmhmmhm avatar Jooel avatar Anton Niklasson avatar Brian Jagodnik avatar Kyle Summers avatar  avatar Nick_Jiang avatar  avatar Bence Csizmadia avatar Martin Ndirangu avatar  avatar Steven avatar Taras Kovalenko avatar Pataky Vince avatar Arturo Silva avatar Aaron Lu avatar Nikita Shekhov avatar  avatar Sourabh Shrishrimal avatar Tuan Duc Tran avatar Ramy avatar Andrei Luca avatar Alex Whiteside avatar  avatar Dr. Olga Ukolova avatar Johns Beharry avatar Michael Canlas avatar Reza Faiz Atta Rahman avatar Andrzej Jędrzejczak avatar Emil Laskowski  avatar Szymon avatar

Watchers

James Cloos avatar  avatar Sean P. Myrick V19.1.7.2 avatar

figma-api-exporter's Issues

[Request] License Clarification

Hey, thanks for the great library! I started playing around with it for an icon exporter I'm working on at @brave but I just realised you don't have a license on the project.

I was wondering if you'd be able to add an open source one?

(also, I have a PR for batching (#4), if you're accepting contributions)

FWIW, most of the stuff at Brave is using the MIT or Mozilla Public License

Breaking changes between 0.0.2 and 1.0.0?

Hi there,

I have your package via some Storybook dependencies, and they rely on 0.0.2. I'm wondering if the API changed at all when you bumped the package to 1.0.0, because 0.0.2 uses an old axios version that dependabot is complaining about.

it looks like you updated packages in 1.0.0 but other projects haven't updated to that yet.

It'd be good for me (and also those other packages) to know if anything interesting changed between the two versions!

thanks

update package

Hello,
Your package is used in storybook, congrats !
Could you please update your npm registry with the latest version (lots of update of dependancies, including a big bump of axios deps)
Thank you :)

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.