Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.