From b8dcabc2ac3819013611fc65aa5bb613535b8fa4 Mon Sep 17 00:00:00 2001 From: Martin Brennan Date: Tue, 1 Apr 2025 13:11:33 +1000 Subject: [PATCH] DEV: Add env var to silence SASS deprecation warnings (#32074) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SASS deprecation warnings are quite noisy, especially when running specs, here is an example: ``` Deprecation Warning [mixed-decls]: Sass's behavior for declarations that appear after nested rules will be changing to match the behavior specified by CSS in an upcoming version. To keep the existing behavior, move the declaration above the nested rule. To opt into the new behavior, wrap the declaration in `& {}`. More info: https://sass-lang.com/d/mixed-decls ╷ 52 │ ┌ @media screen and (max-width: 1048px) { 53 │ │ right: 0; 54 │ │ } │ └─── nested rule ... │ 56 │ background: var(--secondary); │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ declaration ╵ theme-entrypoint/desktop.scss 56:5 @import /home/mb/repos/discourse/desktop.scss 3:9 root stylesheet Deprecation Warning [mixed-decls]: Sass's behavior for declarations that appear after nested rules will be changing to match the behavior specified by CSS in an upcoming version. To keep the existing behavior, move the declaration above the nested rule. To opt into the new behavior, wrap the declaration in `& {}`. ``` This commit adds an env var (`QUIET_SASS_DEPRECATIONS`) to control turning them off. --- lib/stylesheet/compiler.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/stylesheet/compiler.rb b/lib/stylesheet/compiler.rb index 5034f6a501e..003410e8032 100644 --- a/lib/stylesheet/compiler.rb +++ b/lib/stylesheet/compiler.rb @@ -63,6 +63,7 @@ module Stylesheet source_map_contents: true, load_paths: load_paths, silence_deprecations: %w[color-functions import global-builtin], + quiet: ENV["QUIET_SASS_DEPRECATIONS"] == "1", ) result = engine.render