@@ -15,7 +15,7 @@ export const options = [
15
15
} ,
16
16
{
17
17
usage : '-p' ,
18
- description : 'Generate postcss. config.js file.' ,
18
+ description : 'Generate PostCSS config file.' ,
19
19
} ,
20
20
]
21
21
@@ -35,8 +35,9 @@ export function run(cliParams, cliOptions) {
35
35
return new Promise ( ( resolve ) => {
36
36
utils . header ( )
37
37
38
+ const isModule = utils . isModule ( )
38
39
const full = cliOptions . full
39
- const file = cliParams [ 0 ] || constants . defaultConfigFile
40
+ const file = cliParams [ 0 ] || ( isModule ? constants . cjsConfigFile : constants . defaultConfigFile )
40
41
const simplePath = utils . getSimplePath ( file )
41
42
42
43
utils . exists ( file ) && utils . die ( colors . file ( simplePath ) , 'already exists.' )
@@ -52,10 +53,13 @@ export function run(cliParams, cliOptions) {
52
53
utils . log ( emoji . yes , 'Created Tailwind config file:' , colors . file ( simplePath ) )
53
54
54
55
if ( cliOptions . postcss ) {
55
- const path = utils . getSimplePath ( constants . defaultPostCssConfigFile )
56
+ const postCssConfigFile = isModule
57
+ ? constants . cjsPostCssConfigFile
58
+ : constants . defaultPostCssConfigFile
59
+ const path = utils . getSimplePath ( postCssConfigFile )
56
60
utils . exists ( constants . defaultPostCssConfigFile ) &&
57
61
utils . die ( colors . file ( path ) , 'already exists.' )
58
- utils . copyFile ( constants . defaultPostCssConfigStubFile , constants . defaultPostCssConfigFile )
62
+ utils . copyFile ( constants . defaultPostCssConfigStubFile , postCssConfigFile )
59
63
utils . log ( emoji . yes , 'Created PostCSS config file:' , colors . file ( path ) )
60
64
}
61
65
0 commit comments