Refactoring style library help

I’m looking for some advice on refactoring our design system. Currently we have all our library styles in one file, all our library components in another file, and all our individual team files.

I want to refactor the styles into separate library files. To do this I can simply duplicate the current style library, remove the elements I don’t need, publish, and use swap library to achieve the migration.

My question is: Do I do the swap library migration in the components file first and update the ordinary files and then swap the remaining style layers? Or does it matter

Here’s a diagram of what I’m trying to achieve and what I’m looking for is the order of operations eg:

  1. Swap Library in Component Library
  2. Publish components
  3. Update instances in non-library files
  4. Swap library in non-library files

I believe you can cut and paste styles to move them between libraries (just the same as moving components)! Here’s the documentation. It sounds like the connection between the styles and components using those styles is preserved after you first hit publish on your new Styles library.

Oh amazing, I didn’t know they’d added that!