Skip to content

Commit d6c07c7

Browse files
Broccohansl
authored andcommitted
fix(@angular/cli): New project now respect default styleExt (#7430)
Fixes #5599
1 parent b813810 commit d6c07c7

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

packages/@angular/cli/tasks/init.ts

+4
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ export default Task.extend({
5151
const project = this.project;
5252
const packageName = commandOptions.name !== '.' && commandOptions.name || project.name();
5353

54+
if (commandOptions.style === undefined) {
55+
commandOptions.style = CliConfig.fromGlobal().get('defaults.styleExt');
56+
}
57+
5458
if (!packageName) {
5559
const message = 'The `ng ' + this.name + '` command requires a ' +
5660
'package.json in current folder with name attribute or a specified name via arguments. ' +
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import {ng} from '../../../utils/process';
2+
import {createProject} from '../../../utils/project';
3+
import {expectFileToExist} from '../../../utils/fs';
4+
5+
6+
export default function() {
7+
return Promise.resolve()
8+
.then(() => ng('set', 'defaults.styleExt', 'scss', '--global'))
9+
.then(() => createProject('style-project'))
10+
.then(() => expectFileToExist('src/app/app.component.scss'))
11+
12+
// Try to run the unit tests.
13+
.then(() => ng('test', '--single-run'));
14+
}

0 commit comments

Comments
 (0)