@@ -31,21 +31,41 @@ export default (api: AlitaApi) => {
31
31
32
32
api . modifyDefaultConfig ( ( config ) => {
33
33
const draftConfig = config ;
34
- const { theme, px2rem : configPx2rem } = api . userConfig ?. hd || { } ;
34
+ const { hd = { } , mako } = api . userConfig || { } ;
35
+
36
+ const { theme, px2rem : configPx2rem } = hd || { } ;
35
37
draftConfig . theme = {
36
38
...( draftConfig . theme || { } ) ,
37
39
'@hd' : '2px' ,
38
40
...( theme || { } ) ,
39
41
} ;
40
- draftConfig . extraPostCSSPlugins = [
41
- ...( draftConfig . extraPostCSSPlugins || [ ] ) ,
42
- px2rem ( {
42
+ if ( ! mako ) {
43
+ draftConfig . extraPostCSSPlugins = [
44
+ ...( draftConfig . extraPostCSSPlugins || [ ] ) ,
45
+ px2rem ( {
46
+ rootValue : 100 ,
47
+ minPixelValue : 2 ,
48
+ selectorDoubleRemList : [ / ^ .a d m - / , / ^ .a n t - / , / ^ \: r o o t / ] ,
49
+ ...( configPx2rem || { } ) ,
50
+ } ) ,
51
+ ] ;
52
+ } else if ( ! mako ?. px2rem ) {
53
+ const px2remConfig = {
43
54
rootValue : 100 ,
44
55
minPixelValue : 2 ,
45
56
selectorDoubleRemList : [ / ^ .a d m - / , / ^ .a n t - / , / ^ \: r o o t / ] ,
46
57
...( configPx2rem || { } ) ,
47
- } ) ,
48
- ] ;
58
+ } ;
59
+ draftConfig . mako = mako ;
60
+ draftConfig . mako . px2rem = {
61
+ ...px2remConfig ,
62
+ // 将正则转成字符串
63
+ selectorDoubleList : px2remConfig . selectorDoubleRemList . map (
64
+ ( i : string ) => `${ i } ` . replaceAll ( '/' , '' ) ,
65
+ ) ,
66
+ } ;
67
+ }
68
+
49
69
return draftConfig ;
50
70
} ) ;
51
71
0 commit comments