Skip to content

Instantly share code, notes, and snippets.

@bompus
Last active August 2, 2024 03:24
Show Gist options
  • Select an option

  • Save bompus/709ff194af66575b70d376af39c58b63 to your computer and use it in GitHub Desktop.

Select an option

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.
// 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
}
}
}
}
});
@JasonLandbridge
Copy link
Copy Markdown

Thanks you so much for this! Works perfectly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment