简体   繁体   English

bootstrap.js文件-这些是服务器端包含项的唯一类型吗? 这些文件应如何实施?

[英]The bootstrap.js file - are these a unique type of server-side include? How should these files be implemented?

In the bootstrap sass download ( https://github.com/twbs/bootstrap-sass/archive/v3.1.1.tar.gz ) there is a strange bootstrap.js file with all of these lines here commented out, like so: 在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

These correspond to the folder below that has the js files named by each "require" line. 这些对应于下面的文件夹,该文件夹具有由每个“要求”行命名的js文件。

Are these some sort of special server side include system for javascript? 这些是javascript的特殊服务器端包含系统吗?

While we are on the subject, what is the best practice for including these files in a page? 当我们讨论这个主题时,将这些文件包含在页面中的最佳实践是什么? 1 by 1 as they are needed (more requests?) or simply pasting them into a master file as needed (more work indeed, and subject to change, more stuff to track). 根据需要一对一地发送(更多请求?),或者根据需要将它们简单地粘贴到主文件中(确实需要做更多的工作,并且可能会发生变化,需要跟踪的东西更多)。

Perhaps there is something I am missing here. 也许这里有些我想念的东西。

These JS files are intended to be loaded/compiled by Sprockets . 这些JS文件旨在由Sprockets加载/编译。

If you are not using Rails, look at a solution for sinatra: https://gist.github.com/datenimperator/3668587 如果您不使用Rails,请查看sinatra的解决方案: https ://gist.github.com/datenimperator/3668587

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

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