Skip to content

Commit d27306c

Browse files
AlbertLuciantogajus
authored andcommitted
refactor: move default generateScopedName to optionsDefault (#231)
1 parent bc780d5 commit d27306c

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/requireCssModule.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import type {
1818
GenerateScopedNameConfigurationType,
1919
StyleModuleMapType
2020
} from './types';
21+
import optionsDefaults from './schemas/optionsDefaults';
2122

2223
type FiletypeOptionsType = {|
2324
+syntax: string,
@@ -102,7 +103,7 @@ export default (cssSourceFilePath: string, options: OptionsType): StyleModuleMap
102103
if (options.generateScopedName && typeof options.generateScopedName === 'function') {
103104
generateScopedName = options.generateScopedName;
104105
} else {
105-
generateScopedName = genericNames(options.generateScopedName || '[path]___[name]__[local]___[hash:base64:5]', {
106+
generateScopedName = genericNames(options.generateScopedName || optionsDefaults.generateScopedName, {
106107
context: options.context || process.cwd()
107108
});
108109
}

src/schemas/optionsDefaults.js

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const optionsDefaults = {
22
attributeNames: {
33
styleName: 'className'
44
},
5+
generateScopedName: '[path]___[name]__[local]___[hash:base64:5]',
56
handleMissingStyleName: 'throw'
67
};
78

0 commit comments

Comments
 (0)