Bootstrap.js无法与React-Rails gem Rails 4一起使用

时间:2019-07-02 14:10:30

标签: ruby-on-rails-4 asset-pipeline bootstrap-sass react-rails

我的可折叠设备停止工作了。我错误地更新了一些宝石,并且在恢复之前无法恢复到原来的状态,我已经备份了所有内容,除了手风琴和汉堡菜单的导航之外,我都处于意外的工作状态。我正在运行Rails 4.2,Ruby 2.1和Bootstrap-sass 3.3。这也影响了我的bootstrap-datepicker-rails宝石。

HTML

<nav class="navbar navbar-default" role="navigation">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#main-menu">
                <span class="sr-only">Toggle Navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
        </div>

        <div class="collapse navbar-collapse" id="main-menu">
            <ul class="nav navbar-nav">
                <li><%= link_to 'Prospect', '/prospect/' %></li>
                <li><%= link_to 'Current', '/current/' %></li>
                <li><%= link_to 'People', '/people/' %></li>
                <li><%= link_to 'Events', '/events/' %></li>
            </ul>
            <ul class="nav navbar-nav navbar-right">

            </ul>
        </div>
    </nav>

Application.css

 *= require bootstrap-datepicker
 *= require bootstrap
 *= require bootstrap_extensions
 *= require flexslider
 *= require_self
 *= require style
 */

Application.js

//= require react
//= require react_ujs
//= require components
//= require jquery
//= require jquery_ujs
//= require bootstrap-datepicker
//= require turbolinks
//= require bootstrap-sprockets
//= require jquery.flexslider
//= require analytics.js
//= require d3.js
//= require_tree .

宝石文件

source 'https://rubygems.org'


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '>= 4.2'

# Use postgresql as the database for Active Record
gem 'mysql2', '~> 0.4.10'

# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
gem 'bootstrap-sass', '3.3'

# Datepicker for calendar dropdown in forms
gem 'bootstrap-datepicker-rails'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '2.7.2'
gem 'react-rails', '~> 1.5'

# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails'

# Use Flexslider gem for frontpage carosel.
gem 'flexslider'

# Use jquery as the JavaScript library
gem 'jquery-rails'
gem 'jquery-ui-rails'

# Turbolinks makes following links in your web application faster. 
gem 'turbolinks'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'

# tracking/analytics service, Segment.io
gem 'analytics-ruby', '~> 2.2', '>= 2.2.7'

group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', require: false
end


gem 'quiet_assets', :group => :development
gem 'capistrano', '2.15.7', :group => :development
    # cap tasks to manage puma application server  for production add ", :group => :development"


# Use ActiveModel has_secure_password
gem 'bcrypt-ruby', '3.1.2'

# Lock in required capistrano gems
gem 'bundler', '1.17.3'

引导程序同时位于js和css的Vendor文件夹中。

编辑:我进入了bootstrap.css和bootstrap.js文件,并从供应商文件夹中删除了它们。没有css文件,应用程序将不会错误加载。如果没有js文件,则该应用会加载并执行与该js文件相同的操作。

现在我已经挖了更多东西,我不得不设置React-rails来使我的资产管道重新工作,我相信这就是我的问题所在。如何让React-rails在我的vendor / assets文件夹中查看和使用bootstrap.js文件?

0 个答案:

没有答案