Skip to content

Commit 76e24b3

Browse files
committed
fix(@angular/cli): Generating component considers default style extension for project now
1 parent 642f6ba commit 76e24b3

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

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

+7-1
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,16 @@ export default Command.extend({
145145
const cwd = this.project.root;
146146
const schematicName = rawArgs[0];
147147

148-
if (schematicName === 'component' || schematicName === 'directive') {
148+
if (['component', 'c', 'directive', 'd'].indexOf(schematicName) !== -1) {
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)