5

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?

1

2 Answers 2

6

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
Sign up to request clarification or add additional context in comments.

Comments

4

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.

3 Comments

I am using angular-cli and My scss flies are getting compiled except the app.component.scss in root directory
So now your files are compiled from scss/sass to css? I'm struggling with the same problem and as I see, my .scss files from generated components are not compiled and used.
Hi, as of today, you just need to import your scss files in your component. See the official docs.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.