1.0.10 • Published 10 months ago

glypfig v1.0.10

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
10 months ago

Glypfig

NPM Patreon Apache 2.0 license E2E tests and deploy

The icon library workflow for Figma.

Glypfig icon library creator

Picks up your existing icons from Figma and outputs them ready for production. Currently supported export formats include JPG, PDF, PNG, SVG, CSS and React (with typescript support). Can also optimize image assets and builds UI components according to your custom template.

Find an example Storybook with all formats here🚀

Prerequisites

  • NodeJS installed
  • Figma project with a page that has a frame or similar container with icon components
  • Figma API key – Generate new personal access token at Settings -> Account -> Personal access tokens
  • File key – Your file's (with the icon components) key identifier e.g. figma.com/file/{figma-file-key}/Glypfig
  • Node ID – Your frame's URL decoded node ID e.g. figma.com/...?node-id=0%3A1 -> URL decoded to 0:1

Figma notes

To exclude a component to be exported from the frame prefix it's name with a dot e.g. ".Title". Frames and groups along with their child nodes can also be excluded in the same way.

For best results always have your icon component's main layer in Figma boxed with equal width and height e.g. 24x24px.

Development notes

It is suggested to run a linter on build components such as Prettier, Stylelint and code analyser such as ESLint.

Get started

  1. Install Glypfig from NPM with npm or yarn.

    npm install --save-dev glypfig
    yarn add --dev glypfig
  2. Run with your preferred configuration. See all the possible options below.

    npx glypfig --apikey <figma-api-key> --filekey <figma-file-key> --nodeid <icon-frame-node-id>

Configuration

ParameterFlagValueDefaultOptions
Figma API Keyapikey, astringNoneFigma: Settings/Account/Personal access tokens
File keyfilekey, kstringNonee.g. figma.com/file/{figma-file-key}/Glypfig
Node IDnodeid, nstringNonefigma.com/...?node-id=0%3A1 URL param value decoded to 0:1
Output formatformat, fstringpng,svg,reactjpg, png, svg, pdf, css and react
Output pathoutput, ostringicon-librarye.g. ./the-path/to/your-icons
Silent loggingsilent, sbooleanfalsetrue or false
Optimize filesoptimize, pbooleanfalsetrue or false
Template formatstemplate, tstringjsxjsx and tsx
CSS template pathcsspath, cstring./templates/css.etae.g. ./the-path/to/your-template-css.eta
JS template pathjspath, jstring./templates/react-jsx.etae.g. ./the-path/to/your-template-tsx.eta
CSS prefixcssprefix, rstringicon-e.g. 'glypfig-'
JS prefixjsprefix, estringIcone.g. 'Glypfig'
License filelicense, lstring./templates/LICENSE.txtPass '' for default or e.g. ./the-path/to/your-license-file
JPG image scalejpgscale, bstringNoneScale of exported image 0.01 - 4
PNG image scalepngscale, dstringNoneScale of exported image 0.01 - 4
Properties filterfilter, istringNoneFilter components by properties e.g. 'Size=XS, Color=Blue'
Property namingpropnames, mbooleanNoneFigma component properties in name e.g. icon-size-large.svg
Helphelp, hbooleanNoneShow help

More

Support this project

Eta templating engine

Thanks

Helsinki Design System