Replies: 3 comments 3 replies
-
Hi @riboher, thanks a lot for your feedback, this idea looks interesting! |
Beta Was this translation helpful? Give feedback.
-
Hi there! I see figma exports use files API to obtain the information about components (here https://github.com/marcomontalbano/figma-export/blob/master/packages/core/src/lib/export-components.ts#L23), is there a reason why don't use components API instead? It contains super useful information about ancestors already called It tells what is the name of the page containing the component plus the frame name, which allows you to use this information to place your component using a similar hierarchy in your FS after exporting the tokens. |
Beta Was this translation helpful? Give feedback.
-
Hi @alejandrofdiaz and @riboher, first of all, thanks for your contribution. I just released v4.6.0 which contains this feature. This feature adds an option called Before today was only possible to organize components into folders based on the page name and the component name. Today is also possible to create folders based on the path to the component. For example, when you're exporting the component the option [
{ name: 'Logos', type: 'GROUP' },
{ name: 'Logos', type: 'FRAME' }
] Given this, you can setup a folder structure like the following: outputComponentsAsSvg({
output: './output/components/svg',
getDirname: (options) => {
const pathToComponent = options.pathToComponent.map(p => p.name).join(path.sep)
return `${options.pageName}${path.sep}${options.dirname}${path.sep}${pathToComponent}`
},
}) |
Beta Was this translation helpful? Give feedback.
-
Hi there!
First of all thanks for this great library. I've been using it extensively for the last months and it has eased the process of exporting tokens of our Figma files.
One thing that I would like to do in the future is exporting each of my tokens categorized by their parent token name to avoid possible collisions in naming. That doesn't necessarily mean that the components should be returned grouped by this property during the
getComponents
function, but maybe have an extra property with that name so we can group them later.I'm guessing this operations should be done when iterating through each of the children of the page. The type of the component could be checked so if it's
FRAME
, that said property could be added so we know at all times that reference in its children components. Does that make sense to you?Sorry in advanced if I'm not explaining myself in great detail, I'd be glad to provide more insights to this if you find this feedback useful and are open to implement it (I'm glad to provide the changes myself in a PR if that suits you).
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions