File tree 5 files changed +31
-1
lines changed
5 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ npm install --save-dev babel-plugin-css-modules-transform
70
70
" generateScopedName" : " [name]__[local]___[hash:base64:5]" , // in case you don't want to use a function
71
71
" generateScopedName" : " ./path/to/module-exporting-a-function.js" , // in case you want to use a function
72
72
" generateScopedName" : " npm-module-name" ,
73
+ " hashPrefix" : " string" ,
73
74
" ignore" : " *css" ,
74
75
" ignore" : " ./path/to/module-exporting-a-function-or-regexp.js" ,
75
76
" preprocessCss" : " ./path/to/module-exporting-a-function.js" ,
Original file line number Diff line number Diff line change 25
25
},
26
26
"homepage" : " https://github.com/michalkvasnicak/babel-plugin-css-modules-transform#readme" ,
27
27
"dependencies" : {
28
- "css-modules-require-hook" : " ^4.0.2 " ,
28
+ "css-modules-require-hook" : " ^4.0.3 " ,
29
29
"mkdirp" : " ^0.5.1"
30
30
},
31
31
"devDependencies" : {
Original file line number Diff line number Diff line change
1
+ import { isString } from '../utils' ;
2
+
3
+ /**
4
+ * Resolves hashPrefix option for css-modules-require-hook
5
+ *
6
+ * @param {* } value
7
+ * @returns {String }
8
+ */
9
+ export default function hashPrefix ( value /* , currentConfig */ ) {
10
+ if ( ! isString ( value ) ) {
11
+ throw new Error ( `Configuration 'hashPrefix' is not a string` ) ;
12
+ }
13
+
14
+ return value ;
15
+ }
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ export { default as camelCase } from './camelCase';
3
3
export { default as createImportedName } from './createImportedName' ;
4
4
export { default as devMode } from './devMode' ;
5
5
export { default as generateScopedName } from './generateScopedName' ;
6
+ export { default as hashPrefix } from './hashPrefix' ;
6
7
export { default as ignore } from './ignore' ;
7
8
export { default as mode } from './mode' ;
8
9
export { default as prepend } from './prepend' ;
Original file line number Diff line number Diff line change
1
+ import { expect } from 'chai' ;
2
+
3
+ import hashPrefix from '../../src/options_resolvers/hashPrefix' ;
4
+
5
+ describe ( 'options_resolvers/hashPrefix' , ( ) => {
6
+ it ( 'should throw if hashPrefix value is not a string' , ( ) => {
7
+ expect (
8
+ ( ) => hashPrefix ( null )
9
+ ) . to . throw ( ) ;
10
+
11
+ expect ( hashPrefix ( 'hashPrefix' ) ) . to . be . equal ( 'hashPrefix' ) ;
12
+ } ) ;
13
+ } ) ;
You can’t perform that action at this time.
0 commit comments