mikaelvesavuori / figmagic

Figmagic is the missing piece between DevOps and design: Generate design tokens, export graphics, and extract design token-driven React components from your Figma documents.
https://docs.figmagic.com
MIT License
807 stars 71 forks source link

Not ignoring nested frames with prefixes #164

Closed davidbwaters closed 1 year ago

davidbwaters commented 2 years ago

Describe the bug Hi, since you added support for frame variants, it's not ignoring prefixed frames with the '_' or ':' prefixes

Expected behavior These shouldn't be added to the output.

mikaelvesavuori commented 2 years ago

I am not able to reproduce this. Are you using Figmagic 4.5.0? Even the mixed-use messy example here works as intended.

Screenshot 2022-08-05 at 06 58 03

CSS code with a bit of omissions:

const ButtonWithFramesCss = `
  <...>

  &.NormalGroup {
    padding-left: ${spacing['small']};
    padding-right: ${spacing['small']};
    background-color: ${colors['blue1']};
    &:disabled {
      background-color: ${colors['gray1']};
    }
  }

  &.Normal {
    padding-left: ${spacing['small']};
    padding-right: ${spacing['small']};
    background-color: ${colors['blue1']};
    &:disabled {
      background-color: ${colors['gray1']};
    }
  }

  &.Warning {
    padding-left: ${spacing['small']};
    padding-right: ${spacing['small']};
    background-color: ${colors['orange']};
    &:disabled {
      background-color: ${colors['gray1']};
    }
    &:hover {
      background-color: ${colors['yellow']};
    }
  }

  &.Error {
    padding-left: ${spacing['small']};
    padding-right: ${spacing['small']};
    background-color: ${colors['red']};
    &:hover {
      background-color: rgba(123, 34, 34, 1);
    }
  }

`;

export default ButtonWithFramesCss;
mikaelvesavuori commented 2 years ago

Note that : is not an exclusion pattern, but a way to express text being text (i.e. root of element) and then, when used for frames/groups, for subclassing.

davidbwaters commented 2 years ago

Sorry I updated the file with a workaround. I'll post a fork with it how it was, but basically it's the button component's hidden icon with text layer. When it's prefixed with an underscore, it still gets output with the underscore in the class name.

mikaelvesavuori commented 2 years ago

I have indeed seen that (root) elements prefixed with an underscore were not ignored. I will push that fix later in 4.5.1.

EDIT: Out now, see https://github.com/mikaelvesavuori/figmagic/releases/tag/v4.5.1

davidbwaters commented 2 years ago

Awesome, thanks!

mikaelvesavuori commented 2 years ago

Let's close this one as there is nothing more to add here?

davidbwaters commented 2 years ago

Hey, I'm still having the issue after the update. This is the file you can test with. It's the button element's _with-icon child. https://www.figma.com/file/cTi2jRPF169TxakM3pX6Dt/MTX-Figmagic-(Copy)?node-id=3914%3A9510

mikaelvesavuori commented 2 years ago

I don't have permission to access the file.

mikaelvesavuori commented 2 years ago

I am just toying a bit with what I already have and I am pretty sure I see the issue. Figmagic is hard-wired to support only limited nesting, so not only will not underscore exclusions not work, nothing else will either if it's not found in either the root OR in the first-level frames/groups.

When I have access I'll try to verify your new file with my statement.

davidbwaters commented 2 years ago

sorry, I updated the sharing settings

mikaelvesavuori commented 2 years ago

Hey again. Sorry for being late to this. Looking at the file, this is still a structural error in your file rather than with Figmagic itself. The "root" Button should not contain the variants, you will need to drag these into individual, independent frames/groups.

mikaelvesavuori commented 2 years ago

I am ready to close this, if you are OK with it @davidbwaters and have verified that Figmagic is ignoring as per the expected pattern I have written about?

mikaelvesavuori commented 1 year ago

Closing because of lack of activity