Run gulp task before ionic serve/build


#1

Hi,
I’m trying to execute a gulp task before “ionic serve” command. I’ve tried the solution provided here:


My ionic.config.json file:

{
  "name": "APP",
  "app_id": "",
  "v2": false,
  "typescript": false,
  "watch": {
    "sass": ["scss/**/*.scss"],
    "html": ["www/**/*.html"],
    "livereload": [
      "www/**/*.html",
      "www/**/*.js",
      "www/**/*.css"
    ]
  }
}

and I’ve added this to my gulpfile.js:

gulp.task('index', function () {
  var target = gulp.src('./www/index.html');
  // It's not necessary to read the files (will speed up things), we're only after their paths:
  var sources = gulp.src('./www/js/**/*.js', {read: false});

  return target.pipe(inject(sources, {relative: true}))
    .pipe(gulp.dest('./www'));
});

gulp.task('serve:before', ['index','default']);

But nothing is being executed when I run “ionic serve” command.