4

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?

Nicolas
  • 8,077
  • 4
  • 21
  • 51
Konrad Viltersten
  • 36,151
  • 76
  • 250
  • 438

1 Answers1

4

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.)

Konrad Viltersten
  • 36,151
  • 76
  • 250
  • 438
C.OG
  • 6,236
  • 3
  • 20
  • 38
  • What is the dot referring to? My globals reside in the *~/src/app/global.scss* and it seems that using that path in the config gave the expected result. It's +1 for speed and to-the-pointness, though. I see that I have *src/favicon.ico* elsewhere in the file, so I tried *src/app* but it still scream at me in the console... – Konrad Viltersten Dec 03 '19 at 13:27
  • Scratch that. I didn't realize that I had to restart *ng serve* after altering the stupid config file. – Konrad Viltersten Dec 03 '19 at 13:32
  • ha, the _to-the-pointness_ wasn't entirely intentional, had to run off to a meeting :p – C.OG Dec 03 '19 at 14:02