figma-to-html
TypeScript icon, indicating that this package has built-in type declarations

0.0.15 • Public • Published

figma-to-html

NPM version NPM downloads

Install

$ pnpm install figma-to-html

Usage

import { FigmaParser } from "figma-to-html";
const figmaParser = new FigmaParser({
  clientId: "clientId",
  clientSecret: "clientSecret",
  redirectUri: "redirectUri",
});

//single:figma url
figmaParser
  .parse(url, { onProgress: (progress) => {} })
  .then((htmlText) => {
    console.log(htmlText);
  })
  .catch((error) => {
    console.log(error);
  });

//batch:figma url array
figmaParser
  .parseBatch(urls, { onProgress: (progress) => {} })
  .then((htmlText) => {
    console.log(htmlText);
  })
  .catch((error) => {
    console.log(error);
  });

//image
figmaParser
  .parseToImage(url)
  .then((imageUrl) => {
    console.log(imageUrl);
  })
  .catch((error) => {
    console.log(error);
  });

Options

Option Type Default Required Description
clientId string - figma clientId
clientSecret string - figma clientSecret
redirectUri string location.origin + location.pathname figma redirectUri
tpl boolean true template
placeholderImage string - placeholder image url
imageResolver (url: string, type: ImageType) => Promise<string> base64 image resolver image resolver
onProgress (progress: number) => void - progress callback

LICENSE

MIT

Readme

Keywords

Package Sidebar

Install

npm i figma-to-html

Weekly Downloads

32

Version

0.0.15

License

MIT

Unpacked Size

600 kB

Total Files

206

Last publish

Collaborators

  • tangxiaoxin