mercredi 24 août 2016

How do I do if-else in a gulp task in javascript or coffeescript?

Does anyone know how to do if/else in a gulp task in javascript or coffeescript? Here's what I tried in coffee script:

gulp.task 'cordova_setup', 
  if platformName == "android"
    'cordova_setup_android'
  else
    'cordova_setup_ios'

In case it's more helpful, the javascript, translation is this:

gulp.task('cordova_setup', platformName === "android" ? 'cordova_setup_android' : 'cordova_setup_ios');

(I'm creating the gulp task cordova_setup. cordova_setup_android and cordova_setup_ios are other gulp tasks.)

The problem is that, when I run cordova_setup, and set platformName to "iOS", cordova_setup_ios does not run like it should.

(I saw another posting for if/else in coffeescript, but this wasn't related to gulp tasks, and did not help me.)

Any help would be appreciated! Thx!

Aucun commentaire:

Enregistrer un commentaire