1.0.3 • Published 12 years ago

bootstrap-amd v1.0.3

Weekly downloads
3
License
-
Repository
-
Last release
12 years ago

bootstrap-amd

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.

Installing

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

npm install -g bootstrap-amd

Using

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

You can configure the location just like you configure jqueryui-amd to reference the modules with a bootstrap prefix:

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

It's also possible (and probably a good idea) to load all plugins at once. bootstrap-amd creates a file with all modules (bootstrap.js) in the bootstrap directory.

Create a config first:

requirejs.config({
    paths: {
        bootstrap: 'path/to/bootstrap/bootstrap'
    }
});

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

define([ 'bootstrap' ], 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 bootstrap folder with converted modules in the source directory.

Constraints

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.

1.0.3

12 years ago

1.0.2

12 years ago

1.0.1

12 years ago

1.0.0

12 years ago

0.0.3

12 years ago

0.0.2

12 years ago