Skip to content

Commit

Permalink
fix(@angular/cli): New project now respect default styleExt (#7430)
Browse files Browse the repository at this point in the history
Fixes #5599
  • Loading branch information
Brocco authored and hansl committed Aug 22, 2017
1 parent b813810 commit d6c07c7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/@angular/cli/tasks/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ export default Task.extend({
const project = this.project;
const packageName = commandOptions.name !== '.' && commandOptions.name || project.name();

if (commandOptions.style === undefined) {
commandOptions.style = CliConfig.fromGlobal().get('defaults.styleExt');
}

if (!packageName) {
const message = 'The `ng ' + this.name + '` command requires a ' +
'package.json in current folder with name attribute or a specified name via arguments. ' +
Expand Down
14 changes: 14 additions & 0 deletions tests/e2e/tests/commands/new/new-style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import {ng} from '../../../utils/process';
import {createProject} from '../../../utils/project';
import {expectFileToExist} from '../../../utils/fs';


export default function() {
return Promise.resolve()
.then(() => ng('set', 'defaults.styleExt', 'scss', '--global'))
.then(() => createProject('style-project'))
.then(() => expectFileToExist('src/app/app.component.scss'))

// Try to run the unit tests.
.then(() => ng('test', '--single-run'));
}

0 comments on commit d6c07c7

Please sign in to comment.