Join the Webstudio community

Updated last year

Behavior when deleting Tokens

At a glance

The community member describes an issue where deleting a token removes its styles from all instances where it is applied, and there is no way to know which instances have that token applied. This leads to projects becoming bloated with unnecessary tokens as community members avoid deleting them. The community member proposes two solutions:

1. When deleting a token, apply its styles to the local styles of the element, except if the token style is overridden.

2. Modify the "Delete Confirmation" dialog to inform the community member of how many instances have the token applied, and potentially include the paths to those instances.

There are no comments provided.

Currently when deleting a token, all its styles are removed from all instances with that token applied. E.g. if I had a token that changed the background color to red, and that was applied to 10 different instances, deleting that token would remove the red background color from all those instances.

There is also no way of knowing which instances have that token applied. The result is we end up not deleting tokens in fear of unintentionally breaking anything, and over time our projects get bloated with unnecessary tokens.

Here are some ideas that we could implement to solve this problem:

  1. Deleting a token applies its styles to the local styles of the element. E.g. if a token changes the background color to red, then deleting it will migrate that style to the local styles. The exception to this rule is if the token style is overridden, in which case the style will not migrate to the local styles.
  1. Changing the wording of the "Delete Confirmation" dialog to inform us of how many instances have that token applied. Something like:
Delete "token name," which is used in 3 instances?

2.5. We could even add the paths to the instances where the tokens are applied in the Delete Confirmation dialog:
Delete "token name," which is used in 3 instances?
page name>instance
page name>parent component>instance
page name>parent component>child component>instance
Attachment
image.png
Add a reply
Sign up and join the conversation on Discord