Skip to content

Commit 55c8cf7

Browse files
committed
magic replace
1 parent 20a7316 commit 55c8cf7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ module.exports = function createGenerator(pattern, options) {
3939
};
4040

4141
var genericName = interpolateName(loaderContext, name, loaderOptions);
42-
return genericName;
42+
return genericName
43+
.replace(new RegExp('[^a-zA-Z0-9\\-_\u00A0-\uFFFF]', 'g'), '-')
44+
.replace(/^([^a-zA-Z_])/, '_$1');
4345
};
4446
};

0 commit comments

Comments
 (0)