【问题标题】:Upgrading the twitter bootstrap gem from 2.x to 3.x or 4.x is breaking the UI styles将 twitter bootstrap gem 从 2.x 升级到 3.x 或 4.x 会破坏 UI 样式
【发布时间】:2020-10-04 12:33:06
【问题描述】:

我正在尝试从 2.2.8 version to 3.2.2 version 升级 twitter-bootstrap-rails gem 版本,因为 2.2.8 存在漏洞。

但在升级 gem 版本时,它会破坏应用程序导航栏、搜索和模式框等处处的 UI 样式。

我按照official documentation 中给出的步骤进行操作 通过在执行bundle install. 后运行此命令rails generate bootstrap:install less

除此之外,我们还需要更改其他配置吗?我认为这将是一个简单的 gem 升级,但不确定哪里出了问题。

任何帮助将不胜感激。谢谢。

【问题讨论】:

    标签: ruby-on-rails twitter-bootstrap twitter-bootstrap-rails


    【解决方案1】:

    您应该查看 GetBoostrap 文档(“Twitter Bootstrap 的继任者”)并安装

    gem 'bootstrap', '~> 4.5.0'
    

    迁移指南在这里:https://getbootstrap.com/docs/4.5/migration/

    【讨论】:

    • 我按照建议添加了 gem,但它抛出了以下错误 ExecJS::RubyRacerRuntime is not supported. Please replace therubyracer with mini_racer in your Gemfile or use Node.js as ExecJS runtime. 我需要 ruby​​racer gem,所以即使我尝试用 mini_racer 替换它,它也会抛出错误 activesupport-6.0.3.1/lib/active_support/dependencies.rb:324:in require: cannot load such file -- v8 (LoadError)
    • 您还建议从 twitter-bootstrap-rails gem 更改为 bootstrap。这涉及从less到sass。我们试图让它们保持在更少的范围内。所以我相信这与我的预期不同。
    • 你说得对,我认为引导可能是最好的选择。
    • 是的,没错。但我现在想坚持使用twitter-bootstrap-rails。不过感谢您的建议:)
    猜你喜欢
    • 1970-01-01
    • 2016-12-24
    • 1970-01-01
    • 2020-12-16
    • 1970-01-01
    • 2022-12-28
    • 1970-01-01
    • 1970-01-01
    • 2019-07-15
    相关资源
    最近更新 更多