@@ -30,10 +30,14 @@ const datePickerStylePath = `./node_modules/ngx-bootstrap/datepicker/bs-datepic
30
30
/* tslint:disable-next-line: no-default-export */
31
31
export default function ( options : Schema ) : Rule {
32
32
return chain ( [
33
- addStyles ( options ) ,
34
33
addPackageJsonDependencies ( ) ,
35
34
installPackageJsonDependencies ( ) ,
36
- options . component ? addModuleOfComponent ( options . project , options . component ) : noop ( )
35
+ ! options . component || options . component === 'datepicker'
36
+ ? addStyles ( options , insertCommonStyles )
37
+ : addStyles ( options , insertBootstrapStyles ) ,
38
+ options . component
39
+ ? addModuleOfComponent ( options . project , options . component )
40
+ : noop ( )
37
41
] ) ;
38
42
}
39
43
@@ -97,7 +101,7 @@ function addPackageJsonDependencies(): Rule {
97
101
} ;
98
102
}
99
103
100
- export function addStyles ( options : Schema ) : ( host : Tree ) => Tree {
104
+ export function addStyles ( options : Schema , insertStyle : Function ) : ( host : Tree ) => Tree {
101
105
return function ( host : Tree ) : Tree {
102
106
const workspace = getWorkspace ( host ) ;
103
107
const project = getProjectFromWorkspace ( workspace , options . project ) ;
@@ -108,9 +112,14 @@ export function addStyles(options: Schema): (host: Tree) => Tree {
108
112
} ;
109
113
}
110
114
111
- function insertStyle ( project : WorkspaceProject , host : Tree , workspace : WorkspaceSchema ) {
112
- addStyleToTarget ( project , 'build' , host , datePickerStylePath , workspace ) ;
113
- addStyleToTarget ( project , 'test' , host , datePickerStylePath , workspace ) ;
115
+ function insertBootstrapStyles ( project : WorkspaceProject , host : Tree , workspace : WorkspaceSchema ) {
114
116
addStyleToTarget ( project , 'build' , host , bootstrapStylePath , workspace ) ;
115
117
addStyleToTarget ( project , 'test' , host , bootstrapStylePath , workspace ) ;
116
118
}
119
+
120
+ function insertCommonStyles ( project : WorkspaceProject , host : Tree , workspace : WorkspaceSchema ) {
121
+ addStyleToTarget ( project , 'build' , host , datePickerStylePath , workspace ) ;
122
+ addStyleToTarget ( project , 'test' , host , datePickerStylePath , workspace ) ;
123
+
124
+ insertBootstrapStyles ( project , host , workspace ) ;
125
+ }
0 commit comments