@@ -30,6 +30,30 @@ export const getRandomTwConfigFileName = (internalDirectory: string) => {
30
30
) ;
31
31
} ;
32
32
33
+ function getDefaultContent ( appDirectory : string ) {
34
+ const defaultContent = [
35
+ './src/**/*.js' ,
36
+ './src/**/*.jsx' ,
37
+ './src/**/*.ts' ,
38
+ './src/**/*.tsx' ,
39
+ ] ;
40
+
41
+ // Only add storybook and html config when they exist
42
+ // Otherwise, it will cause an unnecessary rebuild
43
+ if ( fs . existsSync ( path . join ( appDirectory , 'storybook' ) ) ) {
44
+ defaultContent . push ( './storybook/**/*' ) ;
45
+ }
46
+ if ( fs . existsSync ( path . join ( appDirectory , 'config/html' ) ) ) {
47
+ defaultContent . push (
48
+ './config/html/**/*.html' ,
49
+ './config/html/**/*.ejs' ,
50
+ './config/html/**/*.hbs' ,
51
+ ) ;
52
+ }
53
+
54
+ return defaultContent ;
55
+ }
56
+
33
57
export default (
34
58
{ pluginName } = {
35
59
pluginName : '@modern-js/plugin-tailwindcss' ,
@@ -50,18 +74,7 @@ export default (
50
74
const haveTwinMacro = await checkTwinMacroExist ( appDirectory ) ;
51
75
const tailwindPath = getTailwindPath ( appDirectory ) ;
52
76
const tailwindVersion = getTailwindVersion ( appDirectory ) ;
53
-
54
- const defaultContent = [
55
- './config/html/**/*.html' ,
56
- './config/html/**/*.ejs' ,
57
- './config/html/**/*.hbs' ,
58
- './src/**/*.js' ,
59
- './src/**/*.jsx' ,
60
- './src/**/*.ts' ,
61
- './src/**/*.tsx' ,
62
- // about storybook
63
- './storybook/**/*' ,
64
- ] ;
77
+ const defaultContent = getDefaultContent ( appDirectory ) ;
65
78
66
79
return {
67
80
prepare ( ) {
0 commit comments