@@ -31,6 +31,7 @@ import {
31
31
url ,
32
32
} from '@angular-devkit/schematics' ;
33
33
import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks' ;
34
+ import { styleToFileExtention } from '../component/index' ;
34
35
import { Schema as ComponentOptions } from '../component/schema' ;
35
36
import { Schema as E2eOptions } from '../e2e/schema' ;
36
37
import {
@@ -48,7 +49,7 @@ import {
48
49
WorkspaceProject ,
49
50
WorkspaceSchema ,
50
51
} from '../utility/workspace-models' ;
51
- import { Schema as ApplicationOptions } from './schema' ;
52
+ import { Schema as ApplicationOptions , Style } from './schema' ;
52
53
53
54
54
55
// TODO: use JsonAST
@@ -162,15 +163,15 @@ function addAppToWorkspaceFile(options: ApplicationOptions, workspace: Workspace
162
163
163
164
if ( options . inlineTemplate === true
164
165
|| options . inlineStyle === true
165
- || options . style !== 'css' ) {
166
+ || options . style !== Style . Css ) {
166
167
schematics [ '@schematics/angular:component' ] = { } ;
167
168
if ( options . inlineTemplate === true ) {
168
169
( schematics [ '@schematics/angular:component' ] as JsonObject ) . inlineTemplate = true ;
169
170
}
170
171
if ( options . inlineStyle === true ) {
171
172
( schematics [ '@schematics/angular:component' ] as JsonObject ) . inlineStyle = true ;
172
173
}
173
- if ( options . style && options . style !== 'css' ) {
174
+ if ( options . style && options . style !== Style . Css ) {
174
175
( schematics [ '@schematics/angular:component' ] as JsonObject ) . styleext = options . style ;
175
176
}
176
177
}
@@ -346,6 +347,8 @@ export default function (options: ApplicationOptions): Rule {
346
347
projectRoot : newProjectRoot ? `${ newProjectRoot } /${ options . name } -e2e` : 'e2e' ,
347
348
} ;
348
349
350
+ const styleExt = styleToFileExtention ( options . style ) ;
351
+
349
352
return chain ( [
350
353
addAppToWorkspaceFile ( options , workspace ) ,
351
354
mergeWith (
@@ -356,6 +359,7 @@ export default function (options: ApplicationOptions): Rule {
356
359
...options ,
357
360
'dot' : '.' ,
358
361
relativePathToWorkspaceRoot,
362
+ styleExt,
359
363
} ) ,
360
364
move ( sourceRoot ) ,
361
365
] ) ) ,
@@ -417,6 +421,7 @@ export default function (options: ApplicationOptions): Rule {
417
421
...options as any , // tslint:disable-line:no-any
418
422
selector : appRootSelector ,
419
423
...componentOptions ,
424
+ styleExt,
420
425
} ) ,
421
426
move ( sourceDir ) ,
422
427
] ) , MergeStrategy . Overwrite ) ,
0 commit comments