选择性地在rails资产管道中加载部分引导程序

时间:2013-07-19 14:53:32

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

Started GET "/assets/bootstrap-transition.js?body=1" for 64.124.65.162 at 2013-07-19   14:40:24 +0000
Served asset /bootstrap-transition.js - 304 Not Modified (0ms)


Started GET "/assets/bootstrap-button.js?body=1" for 64.124.65.162 at 2013-07-19 14:40:24    +0000
Served asset /bootstrap-button.js - 304 Not Modified (0ms)


Started GET "/assets/bootstrap-carousel.js?body=1" for 64.124.65.162 at 2013-07-19 14:40:24 +0000
Served asset /bootstrap-carousel.js - 304 Not Modified (9ms)

以上是我的rails服务器输出的一部分。如果我的应用程序不使用轮播,或计划使用一个...我不应该加载JavaScript。如何选择要加载的引导程序文件?我正在使用bootstrap-sass gem,我的application.js看起来像

//= require jquery
//= require jquery_ujs
//= require bootstrap
//= require_tree .

1 个答案:

答案 0 :(得分:2)

以下是bootstrap-sass gem使用的文件名。随意删除您不需要的插件。文件列在here中,并在自述文件here

中提及
//= require bootstrap-transition
//= require bootstrap-affix
//= require bootstrap-alert
//= require bootstrap-button
//= require bootstrap-carousel
//= require bootstrap-collapse
//= require bootstrap-dropdown
//= require bootstrap-modal
//= require bootstrap-scrollspy
//= require bootstrap-tab
//= require bootstrap-tooltip
//= require bootstrap-popover
//= require bootstrap-typeahead