Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why does this PR exist?
Closes #3165
Pre 2.0 plugin had functionality to update styles whenever tokens or themes change, instead of forcing users to go into the export to Figma dialog. This led to quite a bit of confusion, as theme swapping wasnt working for users anymore who kept their styles in the local document. The old version of the plugin basically updated local styles when you performed a theme swap, 2.0 required you to go to
Export
.What does this pull request do?
This PR re-introduces this. The setting was still lingering around, so I went ahead and renamed this to
shouldUpdateStyles
, re-introduced the setting in the gear menu, and re-added the logic to call the updateStyles function whenever users update tokens or change themes (update.ts)Before:
CleanShot.2024-10-13.at.10.08.20.mp4
After
CleanShot.2024-10-13.at.10.07.32.mp4
Testing this change
Open the .json file attached at the end, create styles the normal way, then enable the Update styles setting in the gear menu, and then later switch themes using the theme dropdown. Notice how now theme swapping appears to work (as under the hood its just updating the style values)
Additional notes
As of now, this setting is OFF by default. We should make sure we update our Docs and inform users about this functionality.