Skip to content

Instantly share code, notes, and snippets.

@himedlooff
Last active April 21, 2024 13:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save himedlooff/237df70df7b6a93cbeecf6e17490b733 to your computer and use it in GitHub Desktop.
Save himedlooff/237df70df7b6a93cbeecf6e17490b733 to your computer and use it in GitHub Desktop.
Regex for finding SCSS variables and class declarations and prepending them with a prefix in Sublime Text

SCSS

Field Value
Find \$([a-z\-_]+)
Where -*.js,-*.woff,-*.woff2
Replace $newprefix-$1

Should match these:

$var: 'test';
$var-2: 'test';
$var-test-3: 'test';
$var-test__4: 'test';

But not these:

$40.00
${}

Class declarations

Field Value
Find (\W\.)([a-z]+[\w\-_]+)
Where -*.html,-*.css,-*.js,-*.woff,-*.woff2,-.gitignore
Replace $1newprefix-$2
@zkmark
Copy link

zkmark commented Apr 21, 2024

how is this used?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment