File tree 3 files changed +14
-9
lines changed
3 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -151,6 +151,10 @@ let commands = {
151
151
args : {
152
152
'--full' : { type : Boolean , description : 'Initialize a full `tailwind.config.js` file' } ,
153
153
'--postcss' : { type : Boolean , description : 'Initialize a `postcss.config.js` file' } ,
154
+ '--types' : {
155
+ type : Boolean ,
156
+ description : 'Add TypeScript types for the `tailwind.config.js` file' ,
157
+ } ,
154
158
'-f' : '--full' ,
155
159
'-p' : '--postcss' ,
156
160
} ,
209
213
help ( {
210
214
usage : [
211
215
'tailwindcss [--input input.css] [--output output.css] [--watch] [options...]' ,
212
- 'tailwindcss init [--full] [--postcss] [options...]' ,
216
+ 'tailwindcss init [--full] [--postcss] [--types] [ options...]' ,
213
217
] ,
214
218
commands : Object . keys ( commands )
215
219
. filter ( ( command ) => command !== 'build' )
@@ -336,6 +340,13 @@ function init() {
336
340
'utf8'
337
341
)
338
342
343
+ if ( args [ '--types' ] ) {
344
+ let typesHeading = "/** @type {import('tailwindcss/types').Config} */"
345
+ stubFile =
346
+ stubFile . replace ( `module.exports = ` , `${ typesHeading } \nconst config = ` ) +
347
+ '\nmodule.exports = config'
348
+ }
349
+
339
350
// Change colors import
340
351
stubFile = stubFile . replace ( '../colors' , 'tailwindcss/colors' )
341
352
Original file line number Diff line number Diff line change 1
- /** @type {import('tailwindcss/types').Config } */
2
- const config = {
1
+ module . exports = {
3
2
content : [ ] ,
4
3
presets : [ ] ,
5
4
darkMode : 'media' , // or 'class'
@@ -952,5 +951,3 @@ const config = {
952
951
] ,
953
952
plugins : [ ] ,
954
953
}
955
-
956
- module . exports = config
Original file line number Diff line number Diff line change 1
- /** @type {import('tailwindcss/types').Config } */
2
- const config = {
1
+ module . exports = {
3
2
content : [ ] ,
4
3
theme : {
5
4
extend : { } ,
6
5
} ,
7
6
plugins : [ ] ,
8
7
}
9
-
10
- module . exports = config
You can’t perform that action at this time.
0 commit comments