Skip to content

Conversation

alan-agius4
Copy link
Collaborator

@alan-agius4 alan-agius4 commented Oct 14, 2024

This commit introduces the functionality to configure a limited number of options for Sass processing in the Angular application builder. The following options have been added to enhance the Sass integration:

  • futureDeprecations: Specifies features that are scheduled for deprecation. The compiler will treat these as active and emit warnings as necessary.
  • fatalDeprecations: Identifies Sass features that are already deprecated and will cause build failures if used.
  • silenceDeprecations: This option suppresses deprecation warnings for specified versions.

Usage example:

"architect": {
  "build": {
    "builder": "@angular-devkit/build-angular:application",
    "options": {
      "outputHashing": "none",
      "namedChunks": true,
      "stylePreprocessorOptions": {
        "sass": {
          "futureDeprecations": ["color-functions"],
          "fatalDeprecations": ["color-functions"],
          "silenceDeprecations": ["1.77.0"]
        }
      }
    }
  }
}

For more information about these options, please refer to the Sass documentation: https://sass-lang.com/documentation/js-api/interfaces/options/

Closes #28587

@angular-robot angular-robot bot added the detected: feature PR contains a feature commit label Oct 14, 2024
@alan-agius4 alan-agius4 added the target: minor This PR is targeted for the next minor release label Oct 14, 2024
@alan-agius4 alan-agius4 requested a review from clydin October 14, 2024 09:11
@alan-agius4 alan-agius4 added the action: review The PR is still awaiting reviews from at least one requested reviewer label Oct 14, 2024
@alan-agius4 alan-agius4 changed the title feat(@angular-build): add sassOptions to stylePreprocessorOptions in application builder feat(@angular/build): add sassOptions to stylePreprocessorOptions in application builder Oct 14, 2024
@alan-agius4 alan-agius4 force-pushed the options-sass branch 2 times, most recently from 4b3c2d8 to 46387b2 Compare October 14, 2024 13:27
@alan-agius4 alan-agius4 changed the title feat(@angular/build): add sassOptions to stylePreprocessorOptions in application builder feat(@angular/build): add sass to stylePreprocessorOptions in application builder Oct 16, 2024
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Oct 16, 2024
…lication builder

This commit introduces the functionality to configure a limited number of options for Sass processing in the Angular application builder. The following options have been added to enhance the Sass integration:

- **futureDeprecations**: Specifies features that are scheduled for deprecation. The compiler will treat these as active and emit warnings as necessary.
- **fatalDeprecations**: Identifies Sass features that are already deprecated and will cause build failures if used.
- **silenceDeprecations**: This option suppresses deprecation warnings for specified versions.

Usage example:
```json
"architect": {
  "build": {
    "builder": "@angular-devkit/build-angular:application",
    "options": {
      "outputHashing": "none",
      "namedChunks": true,
      "stylePreprocessorOptions": {
        "sass": {
          "futureDeprecations": ["color-functions"],
          "fatalDeprecations": ["color-functions"],
          "silenceDeprecations": ["1.77.0"]
        }
      }
    }
  }
}
```

For more information about these options, please refer to the  Sass documentation: https://sass-lang.com/documentation/js-api/interfaces/options/

Closes angular#28587
@alan-agius4 alan-agius4 merged commit b6951f4 into angular:main Oct 16, 2024
30 checks passed
@alan-agius4 alan-agius4 deleted the options-sass branch October 16, 2024 08:31
@L-X-T
Copy link

L-X-T commented Nov 9, 2024

Hi, I just wanted to add the necessary config for Angular V19 to get rid of the sass compiler deprecation warnings:

"stylePreprocessorOptions": {
  "sass": {
    "silenceDeprecations": ["mixed-decls", "color-functions", "global-builtin", "import"]
  }
},

Just in case sb. lands here and is looking for the same solution as I did :-)

@L-X-T
Copy link

L-X-T commented Nov 9, 2024

Another note to @alan-agius4: Your example is misleading, it should look like this:

"architect": {
  "build": {
    "options": {
      "stylePreprocessorOptions": {
        "sass": {
          "fatalDeprecations": ["color-functions", "1.77.0"],
          "futureDeprecations": ["color-functions"],
          "silenceDeprecations": ["color-functions"]
        }
      }
    }
  }
}

This is due to the fact, that only for "fatalDeprecations" you can pass in a sass version, not for the other two.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker area: @angular/build detected: feature PR contains a feature commit target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow to configure sass fatalDeprecations and silenceDeprecations options
3 participants