Skip to content
A conversion script for translating Twitter Bootstrap JS files into AMD JavaScript modules
Find file
Latest commit 67a6a82 @clexit Merge pull request #3 from bitdeli-chef/master
Add a Bitdeli Badge to README


This script converts Twitter Bootstrap JavaScript files into AMD JavaScript modules.

The modules can be loaded by AMD script loaders like RequireJS.

Note: this script is a changed jrburke's jqueryui-amd.


The script requires nodejs 0.6 to run. Use npm to install it:

npm install -g bootstrap-amd


bootstrap-amd path/to/git-cloned-bootstrap

bootstrap-amd sets Transitions module as a dependancy for all modules. If you don't need transitions or want to add them manually, use '--no-transition' key:

bootstrap-amd path/to/git-cloned-bootstrap --no-transition

Configuring AMD loading

Create a config first:

    paths: {
        bootstrap: 'path/to/bootstrap/amd'

...and then just include bootstrap as a dependancy:

define([ 'bootstrap' ], function() {
    //some code

You can use single Bootstrap AMD modules but do it at your own peril. AMD modules are in path/to/bootstrap/amd/src directory. Configure the location just like you configure jqueryui-amd:

    paths: {
        bootstrap: 'path/to/bootstrap/amd/src'

...and then reference the modules with a bootstrap prefix:

define([ 'bootstrap/alert', 'bootstrap/dropdown' ], function() {
    //some code

What happens

The script works with Twitter Bootstrap source directory cloned from github. It doesn't clone the Bootstrap, it just expects a path to this directory as a first argument.

bootstrap-amd creates amd directory with main.js file that contains Twitter Bootstrap AMD and amd/src folder with converted modules.


This script assumes a directory for Twitter Bootstrap contains a js directory.

Since Twitter doesn't write their dependencies anywhere in the code, they are hardcoded in the script.

Bitdeli Badge

Something went wrong with that request. Please try again.