繁体   English   中英

Bootstrap-sass gem Javascript无法在Rails 4中运行

[英]Bootstrap-sass gem Javascript not Working in Rails 4

当使用bootstrap-sass gem时,我已经正确加载了CSS文件,但是在尝试加载javascript文件时却收到错误消息。 我已经按照从https://github.com/twbs/bootstrap-sass加载javascript的过程进行了操作,但是当我在本地主机上查看网页时

我收到错误消息“找不到文件'bootstrap'”

这就是我的application.js文件的样子-任何帮助将不胜感激!
Application.js

 // This is a manifest file that'll be compiled into application.js, which will include all the files // listed below. // // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. // // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the // compiled file. // // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details // about supported directives. // //= require jquery //= require jquery_ujs //= require turbolinks // Loads all Bootstrap javascripts //= require bootstrap //= require_tree . 

Rails 4 中不再使用:assets ,请从Gemfile中删除该组:

Rails 4.0从Gemfile中删除了资产组。 升级时,您需要从Gemfile中删除该行。 您还应该更新您的应用程序文件(在config / application.rb中):

Bundler.require(:默认,Rails.env)

我通过从gemfile的资产组中删除gem'bootstrap-sass','〜> 3.0.3.0'使其工作! 好极了

您是否bundle install并确保要从资产管道加载application.js

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM