Git Product home page Git Product logo

convertiv / handoff-app Goto Github PK

View Code? Open in Web Editor NEW
41.0 5.0 4.0 4.96 MB

A toolchain for Figma design tokens, enabling designers and developers to extract, transform, and distribute design decisions as code

Home Page: https://www.handoff.com/

License: MIT License

JavaScript 3.01% TypeScript 52.34% SCSS 34.35% HTML 10.22% CSS 0.09%
figma figma-api handoff bootstrap css design-system design-tokens figma-plugin scss style-dictionary

handoff-app's Introduction

Handoff - Design Token Automation

A design token pipeline to read figma files, extract tokens as JSON, and transform tokens into dev ready artifacts.

Table of Contents

What Is Handoff?

Handoff is an open source tool for extracting design tokens from the Figma REST API and building frontend developer documentation from that Figma file. By automating the design token delivery, Handoff helps to eliminate bottlenecks between design and development.

Handoff is a collection of 4 javascript tools:

  • Figma Token Extraction - A framework for extracting standardized design foundations and components from Figma.
  • Transformation Pipeline - A set of transformers for producing SASS, CSS, Style Dictionary, and preview snippets from that data.
  • Documentation Web App - A static, client side, Javascript web app that renders live, working previews of your components, tokens and styles.
  • Delivery Tools - Easy build tooling and CI/CD wrapper that allows automation to render and ship the various deliverables as needed.

How does it work?

Handoff works by extracting design foundations and component data from well-formed Figma libraries, storing them as JSON, and then transforming them into design tokens. Those design tokens are published as SASS and CSS variables.

Out of the box, Handoff has native SCSS and CSS maps to connect these tokens to any site using the Bootstrap 5 frontend framework. If you use another framework, or custom CSS, you can easily write map files to connect the generated tokens with your site or application.

Once Handoff extracts design tokens and variables, it builds a statically generated NextJS application that can be published to the web. This asset can be hosted on a static webhost (NGINX, s3/Cloudfront, Cloudflare pages etc).

This pipeline from Figma to the Documentation Web app can be automated via CI/CD to provide automatic, up-to-date, easily readable developer documentation.

Handoff is in Beta!

Handoff is Awesome. Handoff is also really new. We're constantly building new features, and expanding what it can do. We'd love to chat if you have a use case that isn't quite met.

Requirements

  • A paid Figma account is required to publish the Figma file library
  • Node 16+
  • NPM 8+

Get Started

Figma

  1. Open the Handoff Figma starter and duplicate this project to your account

  2. Publish components to the library

  • Click on the Figma logo at the top left
  • Click on Libraries
  • Click on the current file
  • Click publish changes

You'll need a developer token if you don't have one already

  • Click on the Figma logo in the top left
  • Go to Help and Account
  • Click on Account Settings
  • Scroll to Personal Access Token
  • Enter a token name and hit enter
  • Note that token for the next steps

Create a project

  • Run npm install -g handoff-app
  • Create a new directory for your project mkdir my-new-project
  • In that folder (cd my-new-project), run handoff-app fetch
  • Handoff will prompt for your developer token, and the file id of your figma file. The file id can be found in the url of the file - https://www.figma.com/file/{file_id}/{slug}
  • Start the project handoff-app start

This will fetch the latest from your Figma file and it will boot a demo site at http://localhost:3000

Test Fetch

  • Now go back to your Figma file and change a button color
  • Republish the changes to the library. Click on the publish button from the main dropdown. You'll see a list of changes that have been made. Clicking publish will make those changes available to handoff.
  • Back in your project, open a new terminal tab and type npm run fetch

Once that runs, your browser should update with the new colors.

Further Reading

Maintainers

@bradmering

@DomagojGojak.

@Natko.

Contributing

Feel free to dive in! Open an issue or submit PRs.

Handoff follows the Contributor Covenant Code of Conduct.

License

MIT ©Convertiv

handoff-app's People

Contributors

bradmering avatar domagojgojak 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

Watchers

 avatar  avatar  avatar  avatar  avatar

handoff-app's Issues

Support Custom Variants

This commit basically solves all the things we've talked about yesterday. Goal was to remove the need for the variant property "roles" configuration and thus, allow more flexibility. To achieve that, following changes were made:

  1. Exportable (JSON file) now has an updated syntax to share variant over multiple design components based on the variant props. Previously you could do "State(:disabled)" which would automatically apply the "disabled" state to all design components, distinctive only by the theme (which means light theme would have one shared disabled state while dark theme would have a different one). The update allows you to do this "State(:disabled/Theme)" which removes the need for us to know what the theme variant property is and to allow users to distinct over any variant property they have and desire. Plus, one more thing that we allow by this which we didn't allow before is that you can now choose NOT to group/distinct by any variant property. Previously this was not possible as if there was a theme variant property present, it would be automatically used to group by it. This is neat in case if our figma starter had one single disabled button for both themes for example (currently it has one per theme). More flexibility, less need for configuration! 🙂
  2. Paths for preview templates now account for all variant properties, but, if some of them are missing in the integration templates folder for the component, it will be dismissed and we will try starting from the next one (for example, if theme is not there as a folder, we will ignore it and proceed to the next variant prop and so on). This also removes the need for us to know what the theme variant property is as we don't need to filter them out based on if it's a theme variant prop or not (because our integrations do not support themes just yet).
  3. Component titles in the app now have a smarter way of automatically determining the title of the preview component. This is achieved by looking into the filters used to display the previews of the components and decide which variant property you probably want to use in the name of the component preview. It seems to be working great with what we have now, even better than what we have in place currently! In the future we can always add a option to override the title if the user desires to have more control, but for now I don't think this is needed (probably won't be needed at all).

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.