@@ -11,7 +11,10 @@ export default function (defaultLibraryName) {
1111 let selectedMethods ;
1212 let moduleArr ;
1313
14- function camel2Dash ( _str ) {
14+ function parseName ( _str , camel2Dash ) {
15+ if ( ! camel2Dash ) {
16+ return _str ;
17+ }
1518 const str = _str [ 0 ] . toLowerCase ( ) + _str . substr ( 1 ) ;
1619 return str . replace ( / ( [ A - Z ] ) / g, ( $1 ) => `-${ $1 . toLowerCase ( ) } ` ) ;
1720 }
@@ -35,6 +38,7 @@ export default function (defaultLibraryName) {
3538 style,
3639 styleLibrary,
3740 root = '' ,
41+ camel2Dash = true ,
3842 } = options ;
3943 let styleLibraryName = options . styleLibraryName ;
4044 let _root = root ;
@@ -52,7 +56,7 @@ export default function (defaultLibraryName) {
5256 importAll [ path ] = true ;
5357 }
5458 } else {
55- path = `${ libraryName } /${ libDir } /${ camel2Dash ( methodName ) } ` ;
59+ path = `${ libraryName } /${ libDir } /${ parseName ( methodName , camel2Dash ) } ` ;
5660 }
5761 const _path = path ;
5862
@@ -83,11 +87,12 @@ export default function (defaultLibraryName) {
8387 } else {
8488 if ( cache [ libraryName ] !== 1 ) {
8589 /* if set styleLibrary.path(format: [module]/module.css) */
90+ const parsedMethodName = parseName ( methodName , camel2Dash ) ;
8691 if ( modulePathTpl ) {
87- const modulePath = modulePathTpl . replace ( / \[ m o d u l e ] / ig, camel2Dash ( methodName ) ) ;
92+ const modulePath = modulePathTpl . replace ( / \[ m o d u l e ] / ig, parsedMethodName ) ;
8893 path = `${ cachePath [ libraryName ] } /${ modulePath } ` ;
8994 } else {
90- path = `${ cachePath [ libraryName ] } /${ camel2Dash ( methodName ) } .css` ;
95+ path = `${ cachePath [ libraryName ] } /${ parsedMethodName } .css` ;
9196 }
9297 if ( mixin && ! isExist ( path ) ) {
9398 path = style === true ? `${ _path } /style.css` : `${ _path } /${ style } ` ;
0 commit comments