Replacing Code with Visual Studio Code

December 22, 2019

Today I started the process of moving from Stylus to Sass. As a part of that process I also switched to using CSS variables over Stylus or Sass variables. In order to make that transition easy I used find and replace to replace each $variable with --variable - as a manual process this wasn’t too bad. I only had about 20 variables to replace.

Changing all of their appearances however to start with var(--variable) would’ve been painful. Fortunately I leveraged VS Code’s find and replace with regexp to make it painless. (--\w+(?:-\w*)+) found all the CSS variables and I replaced them with var($0), where $0 is the name of the variable I captured originally. Easy!

Last Updated: 2022-04-06 13:57