The following should work in an angular CLI 6 project. I.e if you are getting:
get/set have been deprecated in favor of the config command.
npm install node-sass --save-dev
Then (making sure you change the project name)
ng config projects.YourPorjectName.schematics.@schematics/angular:component.styleext sass
To get your default project name use:
ng config defaultProject
However: If you have migrated your project from <6 up to angular 6 there is a good chance that the config wont be there. In which case you might get:
Invalid JSON character: "s" at 0:0
Therefore a manual editing of angular.json
will be required.
You will want it to look something like this (taking note of the styleex property):
...
"projects": {
"Sassy": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {
"@schematics/angular:component": {
"styleext": "scss"
}
}
...
Seems like an overly complex schema to me. ¯_(?)_/¯
You will now have to go and change all your css/less files to be scss and update any references in components etc, but you should be good to go.