Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sass not compiling with angular-cli

I'm trying to use Sass with angular-cli but it's not working. I'm getting the following error:

EXCEPTION: Failed to load http://localhost:4200/app/app.component.sass.

I've added node-sass to my package.json, changed styleUrls to ['app.component.sass'] and also set "styleExt": "sass" in the angular-cli.json file.

Am I missing something to make it work?

like image 960
brians69 Avatar asked Aug 06 '16 00:08

brians69


2 Answers

Actually it's not right for the moment you can create your projects with precompilers.You should create your project with it.

ng new my_project --style=sass

or if you want to use scss syntax go with:

ng new my_project --style=scss
like image 141
Mertcan Diken Avatar answered Oct 16 '22 18:10

Mertcan Diken


Apparently, there's a minor mistake in the documentation.

styleUrls shouldn't have scss or sass as extension but css instead. Replacing ['app.component.sass'] by ['app.component.css'] solved the problem.

like image 25
brians69 Avatar answered Oct 16 '22 17:10

brians69