diff --git a/packages/@angular/cli/tasks/init.ts b/packages/@angular/cli/tasks/init.ts index 984ccc8b2bc8..dd36103417c0 100644 --- a/packages/@angular/cli/tasks/init.ts +++ b/packages/@angular/cli/tasks/init.ts @@ -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. ' + diff --git a/tests/e2e/tests/commands/new/new-style.ts b/tests/e2e/tests/commands/new/new-style.ts new file mode 100644 index 000000000000..882bab3a88e5 --- /dev/null +++ b/tests/e2e/tests/commands/new/new-style.ts @@ -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')); +}