2

When I run ng build, the generated dist folder doesn't convert scss files to css.

I have a main.scss in my assets folder and .angular-cli.json has:

"styles": [
        "assets/scss/main.scss"
 ],

.....

"styleExt": "scss",
1
  • If this is still an issue, please create a git repo with your app for us to test and update your question. tnx Commented Oct 1, 2017 at 7:07

2 Answers 2

3

You can do ng new myApp --style=scss

Then Angular CLI will create any new component with scss for you...

You also need to use node-sass, install it like this:

npm install node-sass --save-dev

You also need to change styleExt in angular-cli.json to sass...

and use sassCompiler in angular-cli-build.js like this:

sassCompiler: {
    includePaths: [
      'src/app/scss' //here add scss
    ]
 }

and you should be good to go!

for more info visit here.

Sign up to request clarification or add additional context in comments.

11 Comments

I did this before and nothings happens.
did you do npm install node-sass --save-dev ?
Yes but still the same
Did you change styleExt angular-cli.json ? You need to change styleExt in angular-cli.json to sass, also needs sassCompiler: { includePaths: [ 'src/app/style' // here for sass reference files ]... I add them to the answer
StyleExt is equal to sass and still not working. Angular-cli-build.js doesn't appear in my cli version.
|
1

The content of the assets folder isn't changed by angular. Move it to the /app folder and change .angular-cli.json to.

"styles": [
   "main.scss"
 ],

1 Comment

I moved the scss container folder from src/assets to src/, and the I changed the styles path but when I build doesn't appear any css file in the dist folder.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.