【问题标题】:Deprecation Warning in Bootstrap SCSSBootstrap SCSS 中的弃用警告
【发布时间】:2021-08-12 22:57:40
【问题描述】:

我正在尝试通过仅将所需组件从 bootstrap sass 导入 style.scss 文件来创建自定义引导程序。但是,当我导入和编译 3 个必需的组件时,我会收到一连串的弃用警告。

SCSS:

@import "./bootstrap-4.3.1/scss/functions";
@import "./bootstrap-4.3.1/scss/variables";
@import "./bootstrap-4.3.1/scss/mixins";

控制台警告(众多警告中的第一个):

Deprecation Warning: Using / for division is deprecated and will be removed in Dart Sass 2.0.0.

Recommendation: math.div($spacer, 2)

More info and automated migrator: https://sass-lang.com/d/slash-div

    ╷
298 │ $headings-margin-bottom:      $spacer / 2 !default;
    │                               ^^^^^^^^^^^
    ╵
    bootstrap-4.3.1\scss\_variables.scss 298:31  @import
    style.scss 3:9                               root stylesheet

我正在使用以下版本的工具:

引导程序:4.3.1,Sass:1.33.0 compiled with dart2js 2.13.0

使用这个版本组合有什么问题,还是有其他问题?我该如何解决?

【问题讨论】:

  • Bootstrap 4 基于 LibSass。使用 DartSass 编译可能是可能的,但不是最好的主意。 DartSass 的变化来自 BS 版本 5。确实,DartSass 与 LibSass 不同,并且不向后兼容。警告基于 DartSass 中仍然存在的一些功能,例如“中间”向后兼容性,但将在后续版本中删除。 (事实上​​,社区中很难讨论缺少的向后兼容性。)

标签: css bootstrap-4 sass bootstrap-sass


【解决方案1】:

I found a solution here.

基本上,我的理解是SASS 的新版本正在引发警告。您可以降级您的版本以暂时停止警告,这样做也不应该破坏任何东西。

tl:dr您应该改用Sass: "1.32.13"

【讨论】:

  • 工作正常,谢谢!你知道它是否支持 Bootstrap-5 中最新的 sass 吗?
  • 当然可以。不知道 BS5 抱歉,刚刚在我自己的项目中遇到同样的错误时找到了这个解决方案。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-09-04
相关资源
最近更新 更多