1.0.2 • Published 8 years ago

require-rootify v1.0.2

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

require-rootify npm version Build Status

Require a modules within a root directory (browserify transform) with a caret symbol (^)

browser support

Install

NPM

First, you need a browserify project, ofcourse. Then, run npm install --save-dev require-rootify and add to your browserify config something like

    configure: function(bundle) {
      bundle.transform('require-rootify');
    }

Example

Before:

var path        = require('path');                            // Ok, node module
var _           = require('lodash');                          // Ok too, npm module
var myComponent = require('../../../components/myComponent'); // Oh, what is that??

After:

var path        = require('path');                             // Ok, node module
var _           = require('lodash');                           // Ok too, npm module
var myComponent = require('^components/myComponent');         // Yea, much better