npm.io
0.4.0 • Published 11 years agoCLI

borrower

Licence
MIT
Version
0.4.0
Deps
8
Vulns
5
Weekly
0
Stars
1
Install scriptsThis package runs scripts during installation (preinstall/install/postinstall)

Borrower

Gitter Build Status Dependency Status

Forget complexity of Require.js config, don't worry about running Bower install.

Note: this project is a work in progress.

The goal is to keep a single configuration file and a working enviromnemnt with a single install command.

Usage

$ npm install borrower --save

$ node_modules/.bin/borrower install jquery --save

It will install Bower Components in static_modules/ and save dependency in package.json.

html

<script data-main="app.js" src="static_modules/require.js"></script>

Require.js is configured, you can just focus on your Javascript.

That's all folks !

Configuration

package.json

{
    ...
    staticDependencies: [...],
    ...
    config: {
        bower: {
            directory: 'static_modules',  // name of the folfder containing dependencies
            cwd: '',                      // where static modules must be installed
            baseUrl: ''                   // location of the ducoment root
                                          // an absolute path from this location will be used in requirejs config
                                          // if empty, a relative path will be used
        }
    }
}

Configurations from .bowerrc are available in package.json > config > bower

express static example: ...

How it works

$ borrower init

It will register a npm postinstall hook in your package.json to run Bower and configure Require on every npm install.

Require.js is configured inside static_modules/require.js and updated at each install run.