Switch branches/tags
Nothing to show
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
README.md
index.js
package.json
yarn.lock

README.md

unicon-transformer-json

Uses svgo to cleanup each svg, as well as svgson to produce a JSON fragment for each svg.

Install

yarn add unicon-transformer-json --dev
npm install unicon-transformer-json --save-dev

Usage

unicon-cli

When using with unicon-cli you can omit the unicon-transformer portion.

{
  "scripts": {
    "icons": "unicon figma 5XaqhenkjvPmJprGZMFw2ge --name icons --transformer json"
  }
}

node

import { getSvgsFromFigma } from 'unicon'
import svgToJson from 'unicon-transformer-json'

getSvgsFromFigma('5XaqhenkjvPmJprGZMFw2ge', {
  transformSvg: svgToJson,
}).then(svgs => console.log(svgs))

Example Output

{
  "tag": "path",
  "props": {
    "d": "M15.5 14h-.79l-.28-.27A6.471 6.471...",
    "fill": "rainbow"
  },
  "children": ["..."]
}