Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
@figma-export/output-components-as-svgr
Advanced tools
Outputter for @figma-export that exports components as React components using svgr
Outputter for @figma-export that exports components as React components.
With this outputter you can export all Figma components as React components into the specified output folder.
This is a sample of the output from this Figma file:
$ tree output/
# output
# ├── icons
# │ ├── FigmaArrow.jsx
# │ ├── FigmaExport.jsx
# │ ├── FigmaLogo.jsx
# │ └── index.js
# └── unit-test
# ├── figma
# │ ├── logo
# │ │ ├── Main.jsx
# │ │ ├── MainBright.jsx
# │ │ └── index.js
# │ ├── Logo.jsx
# │ └── index.js
# ├── FigmaDefaultLogo.jsx
# └── index.js
Tip: A figma component named
icon/eye
will be exported asEye.jsx
inside theicon
folder. Anotherindex.js
file will be created inside theicon
folder and this will export directly theEye
component.
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-svgr')({
output: './output'
})
]
}],
]
}
output
is mandatory.
getDirname
, getComponentName
, getComponentFilename
, getFileExtension
, getExportTemplate
and getSvgrConfig
are optional.
const path = require('path');
const { pascalCase } = require('@figma-export/utils');
...
require('@figma-export/output-components-as-svgr')({
output: './output',
getDirname: (options) => `${options.pageName}${path.sep}${options.dirname}`,
getComponentName: (options) => `${pascalCase(options.basename)}`,
getComponentFilename = (options): string => `${getComponentName(options)}`,
getFileExtension: (options) => '.jsx',
getSvgrConfig: (options) => ({}),
getExportTemplate = (options): string => {
const reactComponentName = getComponentName(options);
const reactComponentFilename = `${getComponentFilename(options)}${getFileExtension(options)}`;
return `export { default as ${reactComponentName} } from './${reactComponentFilename}';`;
},
})
defaults may change, please refer to
./src/index.ts
getComponentFilename
if not set, it will use the same value for getComponentName
.
getSvgrConfig
is a function that returns the SVGR configuration object.
Using npm:
npm install --save-dev @figma-export/output-components-as-svgr
or using yarn:
yarn add @figma-export/output-components-as-svgr --dev
FAQs
Outputter for @figma-export that exports components as React components using svgr
The npm package @figma-export/output-components-as-svgr receives a total of 830 weekly downloads. As such, @figma-export/output-components-as-svgr popularity was classified as not popular.
We found that @figma-export/output-components-as-svgr demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.