0.0.6 • Published 6 years ago

dot-globals v0.0.6

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

dot-globals

It's convenient for local global variables.

Usage

Install from npm

npm i dot-globals

Create .globals.js file.

Add it to .gitignore.

Set up your global variables, for example:

const env = process.env.NODE_ENV;
const envProduction = (env === 'production');

module.exports = {
    webpackHost: 'localhost',
    webpackPort: '3001',
    serverUrl: envProduction ? 'http://localhost' : 'http://localhost:3000'
};

Require with path param (project root folder is default)

const GLOBALS = require('dot-globals')();

And use them, for example:

devServer: {
        host: GLOBALS.webpackHost,
        port: GLOBALS.webpackPort,
        inline: true,
        hot: true,
        proxy: {
            '/' : {
                target: GLOBALS.serverUrl,
                secure: false
            }
        },
0.0.6

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago