gulp-env-change

1.0.1 • Public • Published

gulp-env-change

Change NODE_ENV in a gulp chain

why?

To change NODE_ENV for specific tasks in your build chain.

If using a single image for deployment over dev/staging/prod, building with NODE_ENV='production' might not be an acceptable solution, this plugin allows you switch NODE_ENV for specific tasks (such as minifying+uglifying a production version without requiring a separate build).

installation

$ npm install --save-dev gulp-env-change

#usage

import envChange from 'gulp-env-change';

gulp.task('foo', () => {
  return gulp.src('./src/*.js')
    .pipe(envChange({environment: 'production'}) // switch NODE_ENV to production for uglify
      .pipe(rename({suffix: '.min'})
      .pipe(uglifyjs())
    .pipe(envChange({environment: 'reset'}) // switch NODE_ENV back to previous setting
    .pipe(gulp.dest('./target/'))
});

Readme

Keywords

none

Package Sidebar

Install

npm i gulp-env-change

Weekly Downloads

2

Version

1.0.1

License

ISC

Last publish

Collaborators

  • kex3