Git Product home page Git Product logo

figma-action's Introduction

GitHub action for exporting Figma components

NOTE: This repository is no longer maintained.

npm version

A GitHub action that will export Figma components from design files to your repository.

Usage

Example workflow

name: Export SVG from Figma
on: [push]
jobs:
  all:
    name: Figma Export
    runs-on: ubuntu-latest
    steps:
      - uses: primer/figma-action@v1.0.0-alpha.3
        with:
          args: "format=svg outputDir=./build/"
        env:
          FIGMA_FILE_URL: "https://www.figma.com/file/ZFjrph2HUwFK8Q3uEtJIu1PT/yourfilename"
          FIGMA_TOKEN: ${{ secrets.FIGMA_TOKEN }}

Variables

Secrets

FIGMA_TOKEN (required)

This token is used to access the Figma API. It's required to generate one so this action will work. It's recommended to set the token in a secret token in your repository.

env variables

FIGMA_FILE_URL (required)

This is the file url that you would like to export from. The action will search the file for components and export them with your configurations.

Workflow args (optional)

  • format – The export format for exporting from Figma. Options are svg, jpg, png. Default is jpg
  • outputDir – Where you would like the exported files to live. Default is ./build/
  • scale – When choosing an image format jpg or png this is the export scale between 0.01 and 4 that will allow you to scale the image. Default is 1.

Output

The output of this action lives in ./build/ by default, but can be configured. In addition to the files exported you will see a data.json file exported. This contains information about the exported components mapped by component id.

The directory will look like this:

./outputDir/
  ├── format/
  |     └── componentName.format
  └── data.json

The data.json file will look like this:

{
  "0:639": {
    "name": "plus", // component name
    "id": "0:639", // component figma id
    "key": "89696b0b52493acc8692546ac829bd4e334c63a2", // component global figma id
    "file": "FP7lqd1V00LUaT5zvdklkkZr", // figma file key
    "description": "keywords: add, new, more", // figma component description
    "width": 12, // width of the component frame
    "height": 16, // height of the component frame
    "image": "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/1/6d/1234" // aws URL for the exported file
  }
}

License

MIT © GitHub

figma-action's People

Contributors

4aficiona2 avatar binarymuse avatar jonrohan avatar leadream avatar svanboxel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

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.