Konrad Viltersten
Konrad Viltersten

Reputation: 39118

Where do I declare load paths for SASS files in Angular 8.x?

According to docs on SASS, I'm supposed to specify load path by adding stylePreprocessorOptions in config file .angular.cli.json as shown below.

"root": "src",
...
"stylePreprocessorOptions": {
  "includePaths": [ "./stylings" ]
}

The config file has changed its name repeatedly, now being angular.json. According to this answer, the new files has not only new syntax but also new schematics.

I can't really figure out where to put the old config specification in the new format nor whether it's changed its name or format.

How do I do this now?

Upvotes: 5

Views: 1413

Answers (1)

C.OG
C.OG

Reputation: 6529

Sample angular.json file:

"projects": {
  "app-name": {
    "projectType": "application",
    "root": "apps/app-name",
    "architect": {
      "build": {
        "builder": "@angular-devkit/build-angular:browser",
        "options": {
          "stylePreprocessorOptions": {
            "includePaths": [
              "."
            ]
          }
    ...
}     

Read more on the workspace config. Remember to restart the application after altering the angular.json file. (Even if the browser reloads the app on save, HMR doesn't respect changes outside the source directory. And the aforementioned file resides in the root.)

Upvotes: 6

Related Questions