πŸš€ DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more β†’
Socket
Book a DemoInstallSign in
Socket

@figma-export/output-components-as-svg

Package Overview
Dependencies
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@figma-export/output-components-as-svg

Outputter for @figma-export that exports components as svg

Source
npmnpm
Version
5.0.0
Version published
Weekly downloads
8.4K
-0.61%
Maintainers
1
Weekly downloads
Β 
Created
Source

@figma-export/output-components-as-svg

Outputter for @figma-export that exports components as svg.

With this outputter you can export all components as svg into the specified output folder.

This is a sample of the output from this Figma file:

$ tree output/
# output
# β”œβ”€β”€ icons
# β”‚   β”œβ”€β”€ figma-arrow.svg
# β”‚   β”œβ”€β”€ figma-export.svg
# β”‚   └── figma-logo.svg
# └── unit-test
#     β”œβ”€β”€ figma
#     β”‚   β”œβ”€β”€ logo
#     β”‚   β”‚   β”œβ”€β”€ main (bright).svg
#     β”‚   β”‚   └── main.svg
#     β”‚   └── logo.svg
#     └── figma default logo.svg

Tip: A component named icon/eye will be exported as eye.svg inside the icon folder.

.figmaexportrc.js

You can easily add this outputter to your .figmaexportrc.js:

module.exports = {
    commands: [
        ['components', {
            fileId: 'fzYhvQpqwhZDUImRz431Qo',
            onlyFromPages: ['icons', 'unit-test'],
            outputters: [
                require('@figma-export/output-components-as-svg')({
                    output: './output'
                })
            ]
        }],
    ]
}

output is mandatory.

getDirname and getBasename are optional.

const path = require('path');

...

require('@figma-export/output-components-as-svg')({
    output: './output',
    getDirname: (options) => `${options.pageName}${path.sep}${options.dirname}`,
    getBasename: (options) => `${options.basename}.svg`,
})

defaults may change, please refer to ./src/index.ts

Install

Using npm:

npm install --save-dev @figma-export/output-components-as-svg

or using yarn:

yarn add @figma-export/output-components-as-svg --dev

Keywords

figma

FAQs

Package last updated on 24 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts