figma-plugin icon indicating copy to clipboard operation
figma-plugin copied to clipboard

In the Styles Actions, add a new "Sync styles" option which renames Styles according to their connected tokens (via Themes), deletes any styles that are not referenced, and creates new styles that do not exist yet

Open six7 opened this issue 3 years ago • 0 comments

As users might rename, create or delete new tokens outside of the Plugin or outside of the library file we are in right now, we need to provide a way so users can 1-click Sync styles according to the new JSON.

To do that, let's add a Sync styles option to the Styles dropdown.

Depending on if the user has an active theme:

Active theme

  • Remove any styles that do not have a style associated (e.g. the user deleted a token on GitHub but now the token needs to be removed as well)
  • Update all values of styles
  • Rename styles that are associated with a token and where the token name is different than the style name

Not-active theme

  • Remove any styles that do not have a token that matches its name
  • Update all values of styles

We should probably add a Modal that appears and asks if they want to (checkboxes):

  • Remove styles without connection
  • Rename styles

One caveat: We should respect the user's setting on Ignore first part of token name for style and Prefix style with active theme name.

six7 avatar Aug 19 '22 07:08 six7