Skip to content

Latest commit

 

History

History

transform-to-jsx

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

@figma-extractor/transform-to-jsx

Parses svg with babel and prepare for using inside JSX components (See example above) – renames attributes to camelCase, removes extra attributes etc. Allows to customize behaviour using Plugins api

import { transformToJsx } from '@figma-extractor/transform-to-jsx'

nodes
    .map((node) => transformToJsx(node))
    .forEach((node) => {
        // node.jsxContent
    })

Exports

  • transformToJsx(node: Node, extraPlugins: Plugin[] = [])
  • svgAttributes(fn: AttributesFn): Plugin for adding extra attributes to svg's root element

Types