|
| 1 | +## Can I Silence the Warnings? |
| 2 | + |
| 3 | +Sass provides a powerful suite of options for managing which deprecation |
| 4 | +warnings you see and when. |
| 5 | + |
| 6 | +### Terse and Verbose Mode |
| 7 | + |
| 8 | +By default, Sass runs in terse mode, where it will only print each type of |
| 9 | +deprecation warning five times before it silences additional warnings. This |
| 10 | +helps ensure that users know when they need to be aware of an upcoming breaking |
| 11 | +change without creating an overwhelming amount of console noise. |
| 12 | + |
| 13 | +If you run Sass in verbose mode instead, it will print *every* deprecation |
| 14 | +warning it encounters. This can be useful for tracking the remaining work to be |
| 15 | +done when fixing deprecations. You can enable verbose mode using the |
| 16 | +[`--verbose` flag] on the command line, or the [`verbose` option] in the |
| 17 | +JavaScript API. |
| 18 | + |
| 19 | +[`--verbose` flag]: /documentation/cli/dart-sass/#verbose |
| 20 | +[`verbose` option]: /documentation/js-api/interfaces/Options/#verbose |
| 21 | + |
| 22 | +{% headsUp %} |
| 23 | + When running from the [JS API], Sass doesn't share any information across |
| 24 | + compilations, so by default it'll print five warnings for *each stylesheet* |
| 25 | + that's compiled. However, you can fix this by writing (or asking the author of |
| 26 | + your favorite framework's Sass plugin to write) a [custom `Logger`] that only |
| 27 | + prints five errors per deprecation and can be shared across multiple |
| 28 | + compilations. |
| 29 | + |
| 30 | + [JS API]: /documentation/js-api/ |
| 31 | + [custom `Logger`]: https://sass-lang.com/documentation/js-api/interfaces/Logger-1/ |
| 32 | +{% endheadsUp %} |
| 33 | + |
| 34 | +### Silencing Deprecations in Dependencies |
| 35 | + |
| 36 | +Sometimes, your dependencies have deprecation warnings that you can't do |
| 37 | +anything about. You can silence deprecation warnings from dependencies while |
| 38 | +still printing them for your app using the [`--quiet-deps` flag] on the command |
| 39 | +line, or the [`quietDeps` option] in the JavaScript API. |
| 40 | + |
| 41 | +[`--quiet-deps` flag]: /documentation/cli/dart-sass/#quiet-deps |
| 42 | +[`quietDeps` option]: /documentation/js-api/interfaces/Options/#quietDeps |
| 43 | + |
| 44 | +For the purposes of this flag, a "dependency" is any stylesheet that's not just |
| 45 | +a series of relative loads from the entrypoint stylesheet. This means anything |
| 46 | +that comes from a load path, and most stylesheets loaded through custom |
| 47 | +importers. |
| 48 | + |
| 49 | +### Silencing Specific Deprecations |
| 50 | + |
| 51 | +If you know that one particular deprecation isn't a problem for you, you can |
| 52 | +silence warnings for that specific deprecation using the |
| 53 | +[`--silence-deprecation` flag] on the command line, or the [`silenceDeprecations` |
| 54 | +option] in the JavaScript API. |
| 55 | + |
| 56 | +[`--silence-deprecation` flag]: /documentation/cli/dart-sass/#silence-deprecation |
| 57 | +[`silenceDeprecations` option]: /documentation/js-api/interfaces/Options/#silenceDeprecations |
| 58 | + |
| 59 | +{% headsUp %} |
| 60 | + This option is only available in the [modern JS API]. |
| 61 | + |
| 62 | + [modern JS API]: /documentation/js-api/#md:usage |
| 63 | +{% endheadsUp %} |
0 commit comments