# global-modulize

[![Build Status](https://travis-ci.org/dinfer/global-modulize.svg?branch=master)](https://travis-ci.org/dinfer/global-modulize)

# Introduction

Import a file by path is painful.
Change the structure of folder likes a tragedy.
So make it accessible globally.

```js
// before
const lib = require('../../../folder/file');

// after
const gm = require('gm');
const lib = gm('lib-name');
```

When you move the file to another place, what you need is set the config file. Not all the files import the file. 

# Usage

Create a config file named `.gm.js` to config name and which file the name is pointing.

```js
export default {
  root: '/',
  entries: {
    name1: './path/to/the/file1',
    name2: './path/to/the/file2',
  },
};
```

Then, when you want to import a file, use it like this:

```js
const gm = require('global-modulize');
const lib1 = gm('name1');
const lib2 = gm('name2');
```
