Last active
August 2, 2024 03:24
-
-
Save bompus/709ff194af66575b70d376af39c58b63 to your computer and use it in GitHub Desktop.
silence dart-sass / npm sass DEPRECATION WARNING: Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// silence dart-sass / npm sass DEPRECATION WARNING: Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0. | |
const silenceSomeSassDeprecationWarnings = { | |
verbose: true, | |
logger: { | |
warn(message, options) { | |
const { stderr } = process; | |
const span = options.span ?? undefined; | |
const stack = (options.stack === 'null' ? undefined : options.stack) ?? undefined; | |
if (options.deprecation) { | |
if (message.startsWith('Using / for division outside of calc() is deprecated')) { | |
// silences above deprecation warning | |
return; | |
} | |
stderr.write('DEPRECATION '); | |
} | |
stderr.write(`WARNING: ${message}\n`); | |
if (span !== undefined) { | |
// output the snippet that is causing this warning | |
stderr.write(`\n"${span.text}"\n`); | |
} | |
if (stack !== undefined) { | |
// indent each line of the stack | |
stderr.write(` ${stack.toString().trimEnd().replace(/\n/gm, '\n ')}\n`); | |
} | |
stderr.write('\n'); | |
} | |
} | |
}; | |
export default defineConfig(() => { | |
return { | |
css: { | |
preprocessorOptions: { | |
sass: { | |
...silenceSomeSassDeprecationWarnings | |
}, | |
scss: { | |
...silenceSomeSassDeprecationWarnings | |
} | |
} | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks you so much for this! Works perfectly!