# grunt-configlobal

> Reads config json file, creates global vars from its content and injects it into a target bundle.

Latest version **0.1.2** (published 2016-11-29) · 0 weekly downloads

## Install

```sh
npm install grunt-configlobal
pnpm add grunt-configlobal
yarn add grunt-configlobal
bun add grunt-configlobal
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2016-11-29 |
| First published | 2016-11-28 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.8.0 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | fr1j0 |
| Maintainers | fr1j0 |
| Keywords | gruntplugin |

## Links

- npm: https://www.npmjs.com/package/grunt-configlobal
- Repository: https://github.com/fr1j0/configlobal
- Issues: https://github.com/fr1j0/configlobal/issues
- npm.io page: https://npm.io/package/grunt-configlobal

## Recent versions

- 0.1.2 (latest) — 2016-11-29
- 0.1.1 — 2016-11-28
- 0.1.0 — 2016-11-28

## README

# grunt-configlobal

> Reads config json file, creates global object from its content and injects it into a target bundle.

## Getting Started
This plugin requires Grunt `~0.4.5`

If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

```shell
npm install grunt-configlobal --save-dev
```

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

```js
grunt.loadNpmTasks('grunt-configlobal');
```

## The "configlobal" task

### Overview
In your project's Gruntfile, add a section named `configlobal` to the data object passed into `grunt.initConfig()`.

```js
grunt.initConfig({
   configlobal: {
        default_options: {
          options: {
          }
        }
      }
});
```

### Options

#### options.target
Type: `String`

Path to js file where to inject the global object.

#### options.config
Type: `String`

Path to configuration JSON file.

#### options.global
Type: `String`

The name of the global object to create to avoid name collisions.

#### options.es6
Type: `Boolean`

Flag to use 'var' (false) or 'const' (true) when declaring the global object.

### Usage Examples

#### Default Options

```js
grunt.initConfig({
   configlobal: {
        dev: {
          options: {
            target: 'js/bundle.js',
            config: 'config.dev.json',
            global: 'CONFIG',
            es6: false
          }
        },
        dist: {
          options: {
            target: 'js/bundle.js',
            config: 'config.dist.json',
            global: 'CONFIG',
            es6: false
          }
        }
      },
});
```


## Contributing
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](http://gruntjs.com/).

## Release History
_(Nothing yet)_

---
_Source: https://npm.io/package/grunt-configlobal · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
