user8398743
user8398743

Reputation:

Angular CLI add SASS after the project has been created

I have an Angular 4 project created using the Angular CLI.

I know that when you are using the Angular CLI you can create a project that uses SASS like this:

ng new ProjectName --style=sass 

My question is: "Can I use the Angular CLI to install SASS after a project has been already created without it?"

Upvotes: 1

Views: 1483

Answers (4)

Aniruddha Das
Aniruddha Das

Reputation: 21698

if you want to do it manually you can also do that by changing the angular cli configuration file

in your .angular-cli.json change style css to scss

  "defaults": {
    "styleExt": "scss"
  }

And then install node-scss to compile your scss files

npm install node-sass --save-dev 

Upvotes: 0

Michael Hancock
Michael Hancock

Reputation: 2855

Using Angular CLI - just do

ng set defaults.styleExt scss

All new components will use SCSS not CSS. Though if you just want to start using SCSS - changing existing .css files to .scss files will work. The relevant compiler is already present batteries included

Upvotes: 0

andrewgi
andrewgi

Reputation: 632

You can set it to style with ng set after installing node-sass

npm install node-sass --save-dev 

ng set defaults.styleExt scss

Taken from here: Angular CLI SASS options

Upvotes: 1

P.S.
P.S.

Reputation: 16384

You can use node-sass, install it by running the following command:

npm install node-sass --save-dev 

Then, if you want to use SASS syntax, run:

ng set defaults.styleExt sass

It should do the trick.

Upvotes: 0

Related Questions