Ionic serve ignoring gulpStartupTasks


#1

I have this ionic.project file:

{
  "name": "foobar",
  "app_id": "com.foo.bar",
  "gulpStartupTasks": [
    "styles",
    "source",
    "watch"
  ],
  "watchPatterns": [
    "www/**/*",
    "!www/lib/**/*"
  ],
  "sourceModules": {
    "ionic": "git://github.com/driftyco/ionic.git",
    "ng-cordova": "git://github.com/driftyco/ng-cordova.git"
  }
}

But the gulp tasks are not being executed, I even added some console.logs to debug but nothing happened.

Any ideas?


#2

I’ve detected that the gulpStartupTasks are being executed asynchronously with the Ionic initialization, so when Ionic tries to find the www folder and don’t find it (because my startup tasks haven’t run yet) it fails and kill the process

But if I create an empty www folder to trick Ionic it works but opens a browser with an error saying that the index.html haven’t been found

However, some seconds after that I see the startup tasks being executed in my shell

And if I refresh the page it works

How can I make these startup tasks run before ionic tries to find the www folder?