tiltshift / figmint

sync Figma styles to JS
MIT License
97 stars 7 forks source link

Exports with "/" in the name break figmint #31

Open scotato opened 3 years ago

scotato commented 3 years ago

In Figma it's common to namespace components with / to make it easier to manage components in your documents. This works fine on figmint colors but it breaks on asset exports.

For example If I have a set of beard components beard/white, beard/black, beard/brown, figmint treats those slashes as directories and somewhere in the code it's not expecting the exports to go into nested directories so it breaks:

Error: ENOENT: no such file or directory, open 'assets/exports/characters/beard/white.png'
Emitted 'error' event on WriteStream instance at:
    at internal/fs/streams.js:375:14
    at FSReqCallback.oncomplete (fs.js:171:23) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: 'assets/exports/characters/beard/white.png'
}

Naming the components with a hyphen instead of a slash works (beard-white), but prevents you from using the built in Figma organization which is based on slashes.

Love the project, I'll see if I can contribute a fix but I'm not familiar with this code base so somebody else might be able to resolve this faster.

scotato commented 3 years ago

My non-code fix for this is to not export components directly but to setup component instance exports renamed without slashes, additionally adding them to named artboards allows the directory creation without errors.

chrisdrackett commented 2 years ago

Sorry for the delay on this, I've been away from this project for a while. I'm getting back to it and want to clean thing up. Not ETA on this issue, just an FYI that I'm working on it!