|
| 1 | +--- |
| 2 | +title: Configure SASS processing during builds |
| 3 | +description: In this article, you'll learn how to configure the SASS processing during builds of your SharePoint Framework (SPFx) projects. |
| 4 | +ms.date: 01/27/2023 |
| 5 | +ms.localizationpriority: high |
| 6 | +--- |
| 7 | + |
| 8 | +# Configure SASS processing during builds |
| 9 | + |
| 10 | +In this article, you'll learn how to configure the SASS processing during builds of your SharePoint Framework (SPFx) projects. |
| 11 | + |
| 12 | +## Updating the toolchain to use a modern SASS processor |
| 13 | + |
| 14 | +The SPFx v1.15 changed the SASS processor the build toolchain used to transpile CSS files from the NPM package [node-sass](https://www.npmjs.com/package/node-sass) to [sass](https://www.npmjs.com/package/sass). The **sass** package is a pure JavaScript implementation of the now-deprecated **dart-sass** package. |
| 15 | + |
| 16 | +This change was primarily made because the [**node-sass** package was deprecated back in 2018](https://sass-lang.com/blog/libsass-is-deprecated), but the **sass** package is also much faster than the **node-sass** package it replaced. |
| 17 | + |
| 18 | +## Impacts of the change |
| 19 | + |
| 20 | +However, changes in the CSS Language required developers to rethink of some of the SASS language paradigms to make it clearer for developers, what a CSS definition is, and what needs to processed by SASS. |
| 21 | + |
| 22 | +When the SPFx toolchain was changed to use the new SASS processor, it required some changes to the SASS code in default SPFx projects as the new processor flagged some syntax errors to address some outdated SASS syntax. These changes introduced some deprecation warnings from the new SASS processor. |
| 23 | + |
| 24 | +Other developers had already dealt with these same deprecation warnings in their projects by getting the SASS package maintainers to add capability to suppress warnings caused by dependencies. |
| 25 | + |
| 26 | +In other words, they needed a way to silence warnings caused by dependencies you don’t own or code potentially that’s inside your SPFx web part. This also happens even to partial files in the same SPFx package. |
| 27 | + |
| 28 | +However, because the **sass** package is added as part of the toolchain, it wasn't easy to configure the processor to silence these deprecations. |
| 29 | + |
| 30 | +## How to silence deprecation warnings in the SASS processor |
| 31 | + |
| 32 | +To address this, all SPFx projects starting with v1.16.1 now include a new file: **./config/sass.json**. |
| 33 | + |
| 34 | +If you have deprecation warnings coming from SASS files you don't maintain in your project, and thus, you have no control over, you can add `"quietDeps": true` to this file to configure the **sass** processor to suppress all deprecation warnings. |
| 35 | + |
| 36 | +```json |
| 37 | +{ |
| 38 | + "$schema": "https://developer.microsoft.com/json-schemas/heft/sass.schema.json", |
| 39 | + "quietDeps": true |
| 40 | +} |
| 41 | +``` |
| 42 | + |
| 43 | +## See also |
| 44 | + |
| 45 | +- [SharePoint Framework v1.16.1 release notes](../release-1.16.1.md) |
| 46 | +- [Stefan Bauer: What’s new with SASS in SPFx 1.16.0](https://n8d.at/whats-new-with-sass-in-spfx-1-16-0)\ |
| 47 | +- [Andrew Connell: Unboxing the SharePoint Framework (SPFx) v1.16.1 release](https://www.voitanos.io/blog/sharepoint-framework-v1-16-1-whats-in-latest-update-of-spfx/) |
0 commit comments