0.1.0 • Published 8 years ago

grunt-envify v0.1.0

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

grunt-envify

Grunt plugin for envify without browserify.

This might not be what you're looking for. If you want to set the variables in process.env, you're looking for grunt-env. If you want to use envify as part of browserify, you want grunt-browserify. This module is only useful if you'd like envify but without the browserify.

Getting Started

This plugin requires Grunt >=0.4.5

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-envify --save-dev

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

grunt.loadNpmTasks('grunt-envify');

The "envify" task

Overview

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

grunt.initConfig({
  envify: {
    options: {
      env: {
        // Pass custom env to use instead of process.env.
      }
    },
    your_target: {
      // Target-specific file lists and/or env sandbox go here.
    }
  }
});

Options

options.env

Type: Object Default value: process.env

An object of env variables to use instead of process.env.

Usage Examples

Default

In this example, process.env is used.

grunt.initConfig({
  envify: {
    your_target: {
      files: {
        'dest/index.js': ['src/index.js']
      }
    }
  }
});

Custom Env

Override process.env with custom variables.

grunt.initConfig({
  envify: {
    your_target: {
      options: {
        env: {
          NODE_ENV: 'production'
        }
      },
      files: {
        'dest/index.js': ['src/index.js']
      }
    }
  }
});

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.

Thanks to the following contributors:

  • @CarlRosell
  • @stefanodacchille

Release History

  • v0.0.3 - 14 January 2016
  • v0.0.2 - 18 July 2014
0.1.0

8 years ago

0.0.3

8 years ago

0.0.2

10 years ago

0.0.1

10 years ago