Skip to content

Instantly share code, notes, and snippets.

@himedlooff
Last active April 21, 2024 13:28
Show Gist options
  • Select an option

  • Save himedlooff/237df70df7b6a93cbeecf6e17490b733 to your computer and use it in GitHub Desktop.

Select an option

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

zkmark commented Apr 21, 2024

Copy link
Copy Markdown

how is this used?

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