Skip to content
This repository was archived by the owner on Nov 4, 2021. It is now read-only.

Conversation

@mkuklis
Copy link

@mkuklis mkuklis commented Jun 1, 2016

Hi guys,

I ran into a situation where I needed to pass some env variables to the ionic build. This pull request adds support for envify. This should allow to pass variables from gulp like this:

gulp.task('build', ['clean'], function(done){
  runSequence(
    ['sass', 'html', 'fonts', 'scripts'],
    function(){
      buildBrowserify({
        minify: isRelease,
        browserifyOptions: {
          debug: !isRelease
        },
        uglifyOptions: {
          mangle: false
        },
        envifyOptions: { ENV: 'production' } 
      }).on('end', done);
    }
  );
});

and later access them with:

if (process.env.ENV == "production") {
 // do something
}

It looks like some other people asked about it too:

https://forum.ionicframework.com/t/debate-ionic-2-environment-development-variables-setup/44061

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant