javascript - Adding bootstrap.js to browserify? -


so trying figure out how this? downloaded bootstrap-sass via bower , added bootstrap javascript shim.

a few things have me confused, bootstrap.js file looks this.

//= 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 

this kind of self explanatory, still confusing @ same time, leave commented that? when add bootstrap shim include bootstrap.js file, or should link ones need?

just save myself hacking away (which doing in meantime), i'd try information on how include bootstrap.js browserify.

edit: think might have concat files need , include script, because when browserify bootstrap.js above.

i'll try without comments, if fails i'll concat scripts 1 file , see happens :)

edit: hmm looks concat theory works! thing jquery, take look.

; 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)  * ======================================================================== */ 

this compiled browserify code, way work when call bootstrap function example $('body').modal('toggle') have change jquery above $ manually.

i tried using both inside shim still same thing must manually write $. example

// notice use $ here not jquery above, way 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)  * ======================================================================== */ 

this answer original questioner. posted edit question. moved here, answers go.

i recompiled , looks it's working now, make sure inside shim use $

'bootstrap': {     "exports": 'bootstrap',     "depends": {         "jquery": '$'     } }, 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

inno setup - TLabel or TNewStaticText - change .Font.Style on Focus like Cursor changes with .Cursor -