Skip to content

Commit 4d0c93e

Browse files
AhsanAyazBrocco
authored andcommitted
fix(@angular/cli): Generating component considers default style extension for project now
1 parent 2da72e5 commit 4d0c93e

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

packages/@angular/cli/commands/generate.ts

+6
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,12 @@ export default Command.extend({
149149
if (commandOptions.prefix === undefined) {
150150
commandOptions.prefix = appConfig.prefix;
151151
}
152+
153+
if (schematicName === 'component' || schematicName === 'c') {
154+
if (commandOptions.styleext === undefined) {
155+
commandOptions.styleext = CliConfig.getValue('defaults.styleExt');
156+
}
157+
}
152158
}
153159

154160
const SchematicRunTask = require('../tasks/schematic-run').default;

packages/@angular/cli/tasks/schematic-run.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,7 @@ function prepOptions(schematic: Schematic<{}, {}>, options: SchematicOptions): S
177177

178178
const properties = (<any>schematic.description).schemaJson.properties;
179179
const keys = Object.keys(properties);
180-
181-
if (schematic.description.name === 'component') {
180+
if (['component', 'c', 'directive', 'd'].indexOf(schematic.description.name) !== -1) {
182181
options.prefix = (options.prefix === 'false' || options.prefix === '')
183182
? '' : options.prefix;
184183
}

0 commit comments

Comments
 (0)