为什么 CSS 函数 clamp 被写入 Sass unquote 函数?

Why was the CSS function clamp written into an Sass unquote function?

在我接手的一个项目中,样式是用SCSS写的。有一次我想知道为什么 CSS clamp() 函数是用反引号写的。如果我删除 unquote 则没有区别。

div {
  font-size:unquote("clamp(30px, 10px + 2%, 30px)");
}

并且没有取消引号

div {
  font-size:clamp(30px, 10px + 2%, 30px);
}

问题:

为什么又把clamp函数放到unquote函数里了?如果没有!

可能使用了 unquote 函数,因为函数中的文本来自其他程序或服务的字符串,因此为了确保它能像 CSS 一样工作,他们在传输到 CSS.

文档是这么说的:

You can convert a quoted string to an unquoted string using the string.unquote() function, and you can convert an unquoted string to a quoted string using the string.quote() function.

所以这意味着 unquote 函数基本上是无用的,因为它唯一做的就是取消引用 "clamp(30px, 10px + 2%, 30px)",这将导致 clamp(30px, 10px + 2%, 30px) 完全相同。

有人可以这样做的原因是错误原因,如果 sass 本身存在错误(clamp 函数仅适用于 unquote),那么也许这就是程序员添加的原因这个。

这个特定错误的概率当然很低,但这只是一种理论...