【问题标题】:Using a function in Sass is returning the string containing the name of the function rather than the result在 Sass 中使用函数是返回包含函数名称而不是结果的字符串
【发布时间】:2023-04-09 16:03:01
【问题描述】:

我正在尝试 Zurb Foundation 5。

所以,我创建了一个新项目并尝试更改设置。例如,当我在 my-project/scss/settings.scss 中更改 $row-width: rem-calc(1170); 时,它(在 my-project/stylesheets/app.css 中)编译为:

.row {
  max-width: rem-calc(1170);
}

它似乎不知道 rem-calc 功能。 如何让它正确计算rem-calc?

【问题讨论】:

    标签: sass zurb-foundation compass-sass


    【解决方案1】:

    您的函数不存在。在使用它之前,您必须声明它(或从另一个文件中导入它)。 Sass 不会为不存在的函数抛出错误,因为它们的语法与 CSS 函数相似。所以它假设如果它不是一个 Sass 函数,它必须是一个 CSS 函数。

    相关:Test whether a Sass function is defined

    【讨论】:

    • 我已经完成了@import "foundation/functions";在 settings.scss 中,现在它可以工作了,谢谢
    猜你喜欢
    • 1970-01-01
    • 2015-10-17
    • 1970-01-01
    相关资源
    最近更新 更多