@@ -15,7 +15,7 @@ export const options = [
1515 } ,
1616 {
1717 usage : '-p' ,
18- description : 'Generate postcss. config.js file.' ,
18+ description : 'Generate PostCSS config file.' ,
1919 } ,
2020]
2121
@@ -35,8 +35,9 @@ export function run(cliParams, cliOptions) {
3535 return new Promise ( ( resolve ) => {
3636 utils . header ( )
3737
38+ const isModule = utils . isModule ( )
3839 const full = cliOptions . full
39- const file = cliParams [ 0 ] || constants . defaultConfigFile
40+ const file = cliParams [ 0 ] || ( isModule ? constants . cjsConfigFile : constants . defaultConfigFile )
4041 const simplePath = utils . getSimplePath ( file )
4142
4243 utils . exists ( file ) && utils . die ( colors . file ( simplePath ) , 'already exists.' )
@@ -52,10 +53,13 @@ export function run(cliParams, cliOptions) {
5253 utils . log ( emoji . yes , 'Created Tailwind config file:' , colors . file ( simplePath ) )
5354
5455 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 )
5660 utils . exists ( constants . defaultPostCssConfigFile ) &&
5761 utils . die ( colors . file ( path ) , 'already exists.' )
58- utils . copyFile ( constants . defaultPostCssConfigStubFile , constants . defaultPostCssConfigFile )
62+ utils . copyFile ( constants . defaultPostCssConfigStubFile , postCssConfigFile )
5963 utils . log ( emoji . yes , 'Created PostCSS config file:' , colors . file ( path ) )
6064 }
6165
0 commit comments