Skip to content

environment specific build ? #460

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sebastianovide opened this issue Mar 31, 2015 · 2 comments
Closed

environment specific build ? #460

sebastianovide opened this issue Mar 31, 2015 · 2 comments

Comments

@sebastianovide
Copy link

Hi All,

I'm reading about gulp-preprocess for being able to build for different environments. In my case I'm using firebase and I need different one firebase for testing and one for live.

Before jumping into gulp-preprocess I just wanted to check out if this project has already something equivalent ?

thanks

@zckrs
Copy link
Collaborator

zckrs commented Mar 31, 2015

Nope we don't have equivalent.
But I think you can choose different Firebase more simply with gulp-ng-constant

1) create a new task config

gulp.task('config', function () {
  var configPath = 'config.json';
  if (process.env.NODE_ENV === 'test') {
    configPath = 'configTest.json';
  }
  return gulp.src(configPath)
    .pipe($.ngConstant())
    .pipe(gulp.dest('src/app/'));
});

2) add config as a dependency of scripts

module.exports = function(options) {
  gulp.task('scripts', ['config'], function () {
    return gulp.src(options.src + '/app/**/*.js')
      .pipe($.jshint())
      .pipe($.jshint.reporter('jshint-stylish'))
      .pipe(browserSync.reload({ stream: true }))
      .pipe($.size());
  });
};

3) use the module constante created in your app

4) run gulp with environnement variable

$ NODE_ENV=test gulp serve
$ NODE_ENV=test gulp

Anyway if you use gulp-preprocess, PR is welcome (to add in advanced option)

@zckrs
Copy link
Collaborator

zckrs commented Apr 15, 2015

Solved ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants