Cant use sass math.div?

By default, Hugo transpiles Sass to CSS using LibSass, which does not support math.div. See:
https://sass-lang.com/documentation/modules/math

Option 1: Use / instead of math.div

For example, instead of this:

@use "sass:math";

body {
  font-size: math.div(32px, 2);
}

do this:

body {
  font-size: (32px/2);
}

Option 2: Configure Hugo to use Dart Sass instead of LibSass

See https://gohugo.io/hugo-pipes/scss-sass/#options.

1 Like