# grunt-envfile

> Grunt plugin to provide variables in .env file in process.env and Grunt templates.

Latest version **0.1.0** (published 2017-12-05) · 0 weekly downloads

## Install

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

## 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.0 |
| Published | 2017-12-05 |
| First published | 2017-12-05 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 6.12.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | John Halbert |
| Maintainers | johnhalbert |
| Keywords | gruntplugin |

## Links

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

## Dependencies (1)

- [ini](https://npm.io/package/ini.md) ^1.3.5

## Recent versions

- 0.1.0 (latest) — 2017-12-05

## README

# grunt-envfile

> Grunt plugin to provide variables in .env files in process.env and Grunt templates.

## 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-envfile --save-dev
```

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

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

## The "envfile" task

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

No options are necessary, task can be defined singly or as a multi-task with multiple targets.  In either configuration all that's needed in the task, or for each target, is a `src` member and envfile location(s).

```js
grunt.initConfig({
  envfile: {
    src: [ './.env' ], // defined singly for the task
    your_target: {
      // Or defined as a multi-task with more than one target
      src: [ './.env' ]
    }
  }
});
```

Envfiles should be in the following format:

```
MY_VAR=value
MY_SECOND_VAR="second value"
```

These values become available for use in `process.env` or in Grunt templates:

```
process.env.MY_VAR === 'value' // true

grunt.initConfig({
  my_task: {
    some_val: '<%= MY_VAR %>' 
  }
});

// some_val will now hold the value 'value'.
grunt.registerTask('the_task', ['envfile:my_target', 'my_task']);
```

## Release History
- 0.1.0 - Initial release.

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