Simple dependency injection and library loader.
Simple dependency injection and library loader for node.
Rely allows you to depend on named libraries which can be overriden in the configuration.
var rely = require'rely'options;relyrun'dependency1' 'dependency2'// the dependencies will be automatically injected.dep1doSomeCoolStuff;;
require() rely once in your main script, then use it to load all other dependencies.
This way, all other modules share a common container (dependency configuration). Rely can load
modules that have not been designed to use Rely, and the dependencies for those modules will still
To make the best use of Rely, define modules using the Asynchronous Module Definition:
define"alpha" "require" "exports" "beta"return betaverb;//Or:return require"beta"verb;;
As well as loading modules that have been defined using
define(), modules can be mapped to files
// set implementation to be provided for 'name'relymap'name' implementation;
implementation can be the name of another module to alias, the path to the
implementation script, or any value to set as the implementation.
You can also specify all dependencies at the same time by calling
map() with an object:
relymap'foo': foo'bar': bar;
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
See the CHANGELOG
Copyright (c) 2013 Gordon Mackenzie-Leigh Licensed under the MIT license.