Skip to content

Commit de54643

Browse files
author
Michael Vurchio
committed
Add correct regex
1 parent a380d22 commit de54643

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const pluginOptions = {
1010
const regex = {
1111
module: /\$(style)?\.(:?[\w\d-]*)/gm,
1212
style: /<style(\s[^]*?)?>([^]*?)<\/style>/gi,
13+
pathUnallowed: /[<>:"/\\|?*]/g,
1314
class: (className) => {
1415
return new RegExp(`\\.(${className})\\b(?![-_])`, 'gm')
1516
}
@@ -32,7 +33,7 @@ function generateName(resourcePath, styles, className) {
3233
);
3334

3435
// replace unwanted characters from [path]
35-
if (/[<>:"/\\|?*]/g.test(interpolatedName)) {
36+
if (regex.pathUnallowed.test(interpolatedName)) {
3637
interpolatedName = interpolatedName.replace(regex.pathUnallowed, '_');
3738
}
3839

0 commit comments

Comments
 (0)