javascript - bootstrap.js 文件 - 这些是服务器端包含的独特类型吗?这些文件应该如何实现?

标签 javascript css ruby twitter-bootstrap rubygems

在 bootstrap sass 下载 ( https://github.com/twbs/bootstrap-sass/archive/v3.1.1.tar.gz ) 中有一个奇怪的 bootstrap.js 文件,其中所有这些行都被注释掉了,如下所示:

//= require bootstrap/affix
//= require bootstrap/alert
//= require bootstrap/button
//= require bootstrap/carousel
//= require bootstrap/collapse
//= require bootstrap/dropdown
//= require bootstrap/tab
//= require bootstrap/transition
//= require bootstrap/scrollspy
//= require bootstrap/modal
//= require bootstrap/tooltip
//= require bootstrap/popover

这些对应于下面的文件夹,其中包含由每个“require”行命名的 js 文件。

这些是某种特殊的服务器端包含 javascript 的系统吗?

当我们讨论这个主题时,将这些文件包含在页面中的最佳做法是什么?根据需要 1 对 1(更多请求?)或根据需要将它们简单地粘贴到主文件中(确实需要更多工作,并且可能会发生变化,需要跟踪更多内容)。

也许我在这里遗漏了什么。

最佳答案

这些 JS 文件旨在由 Sprockets 加载/编译.

如果您不使用 Rails,请查看 sinatra 的解决方案:https://gist.github.com/datenimperator/3668587

关于javascript - bootstrap.js 文件 - 这些是服务器端包含的独特类型吗?这些文件应该如何实现?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24299791/

相关文章:

javascript - 在 Ajax 中处理非常大的 Long 数字的最佳方法?

javascript - 使用 eval 时如何找到 Javascript 语法错误的位置?

javascript - 如何在滚动时正确淡入DIV?

ruby - capybara 有_selector吗?等

javascript - Ruby on Rails,使用 JavaScript 更改图像源

javascript - 无法在页面刷新时获取元素宽度

javascript - 如何通过浏览器检测某个协议(protocol)是否受支持?

jquery - 无法使我的 lightbox2 在 IE 8 和 7 上工作

javascript - Chrome : Scaling image makes it break the overflow of outer div while increasing

ruby-on-rails - 无法在centos上安装therubyracer(V8和GCC出错)