【问题标题】:Bootstrap rails gem: customize which JS components are included?Bootstrap rails gem:自定义包含哪些 JS 组件?
【发布时间】:2019-10-22 13:16:59
【问题描述】:

使用 bootstrap rails gem,我们可以像这样自定义要包含的 CSS:

@import "bootstrap/mixins";
@import "bootstrap/root";
@import "bootstrap/reboot";
@import "bootstrap/type";
@import "bootstrap/images";

但在 JS 方面,以下包括所有 Bootstrap 组件:

require bootstrap-sprockets

有没有办法包含一些 Bootstrap 的 JS 组件而不是所有东西来消除臃肿?

【问题讨论】:

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


    【解决方案1】:

    是的..这是可能的。 我已经安装了这个 gem

    gem 'bootstrap-sass', '~> 3.2.0'
    

    和 application.js

    // Only require the bootstrap parts we need  //= require bootstrap-sprockets
    // Collapse and dropdown for nav 
    //= require bootstrap/modal
    //= require bootstrap/collapse
    //= require bootstrap/dropdown
    

    【讨论】:

    • 是否有可以包含所有这些组件的列表?它不能在 gem 文档中找到它。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多