Mic*_*bry 9 javascript jquery node.js twitter-bootstrap browserify
所以我想弄清楚如何做到这一点?我通过bower下载了bootstrap-sass并将bootstrap javascript添加到垫片中.
有些事让我困惑,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
Run Code Online (Sandbox Code Playgroud)
这是一种自我解释,但同时仍然令人困惑,我是否会这样评论?当我添加到bootstrap shim时,我只包含bootstrap.js文件,还是应该链接到我需要的所有文件?
为了避免被黑客攻击(我将在此期间进行),我想尝试获取有关如何将bootstrap.js包含在browserify中的一些信息.
编辑:我想我可能只需要连接我需要的所有文件并包含该脚本,因为当我浏览bootstrap.js时,我就得到了上述内容.
我会尝试没有评论,然后如果失败我会将所有脚本连成一个文件,看看会发生什么:)
编辑:嗯看起来像concat理论的作品!唯一的问题是jQuery,看一看.
; jQuery = global.jQuery = require("c:\\wamp\\www\\mysite\\app\\client\\requires\\jquery\\js\\jquery.js");
/* ========================================================================
* Bootstrap: affix.js v3.1.1
* http://getbootstrap.com/javascript/#affix
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
Run Code Online (Sandbox Code Playgroud)
这是我编译的浏览器代码,当我调用bootstrap函数时让它工作的唯一方法就是说$('body').modal('toggle')我必须手动更改jQuery上面的内容$.
我尝试在我的垫片中使用两者,但仍然必须手动编写$.例
// Notice I use $ here not jQuery like above, this is the only way to get it to work!
; $ = global.jQuery = require("c:\\wamp\\www\\mysite\\app\\client\\requires\\jquery\\js\\jquery.js");
/* ========================================================================
* Bootstrap: affix.js v3.1.1
* http://getbootstrap.com/javascript/#affix
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
Run Code Online (Sandbox Code Playgroud)
Tro*_*ott 12
这个答案是由原始提问者提出的.它是作为问题的编辑发布的.我把它移到这里,答案就在那里.
我重新编译了它看起来现在正在工作,请确保你使用的垫片内部
$Run Code Online (Sandbox Code Playgroud)"bootstrap": { "exports": "bootstrap", "depends": { "jquery": "$" } },
| 归档时间: |
|
| 查看次数: |
5748 次 |
| 最近记录: |