Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”.

In the latest version of Sass, there is a warning ⚠️ when using “/” when using division

DEPRECATION WARNING: Using/for division is deprecated and will be removed in Dart Sass 2.0.0.Copy the code

The first method is to degrade the SASS version

"Sass ": "~1.32.13" or "sass": "1.32.13"Copy the code

The second:

$ npm install -g sass-migrator
$ sass-migrator division **/*.scss
Copy the code

The third is to use Math

@use 'sass:math';
Copy the code

If you’re using Vite and you’ve already set up the following code you’ll notice that it tells you to go to the top level anyway, right

css: { preprocessorOptions: { scss: { additionalData: '@import "./src/assets/style/variable.scss"; @import "./src/assets/style/utils.scss"; '}}},Copy the code

So we need to write

css: { preprocessorOptions: { scss: { additionalData: '@use "sass:math"; @import "./src/assets/style/variable.scss"; @import "./src/assets/style/utils.scss"; '}}},Copy the code

Reference:

Sass-lang.com/documentati…