Example #1
0
gulp.task('index.w', ['index'], () => gulp.watch(PATHS.src.custom.index, ['index']));

gulp.task('lint', ['tsLint']);

gulp.task('ts', ['clean.dist'], (cb) => compileTs(PATHS.src.custom.tsApp, TSC_APP_OPTS, cb));

gulp.task('ts.w', ['tsLint.w', 'clean.dist'], () => compileTsWatch(PATHS.src.custom.tsApp, TSC_APP_OPTS));

gulp.task('test.build', ['clean.test'], (cb) => compileTs(PATHS.src.custom.test, TSC_TEST_OPTS, cb));

gulp.task('test.build.w', ['tsLint.w', 'clean.test'], () => compileTsWatch(PATHS.src.custom.test, TSC_TEST_OPTS));

gulp.task('karma', ['clean.coverage'], (cb) => startKarma(true, cb));

gulp.task('test', seq('test.build', 'karma'));

gulp.task('build', ['clean.dist'], seq(
  ['copyOnlyLib', 'cssLib', 'font', 'jsLib', 'css', 'tpl', 'tsLint', 'ts', 'index'])
);

gulp.task('reload.w', () => gulp.watch(`${PATHS.dest.dist.base}/**/*`, (evt: any) => notifyLiveReload(evt.path)));

gulp.task('build.w', ['clean.dist'], seq(
  ['copyOnlyLib', 'cssLib', 'font', 'jsLib', 'css.w', 'tpl.w', 'ts.w', 'index.w'], 'reload.w')
);

gulp.task('server.w', (done) =>
  nodemon({
    script: 'server/boot.ts',
    watch: 'server',
  const relativePath = path.dirname(path.relative(__dirname, filePath));
  return slash(relativePath).replace(FIRST_PATH_SEGMENT, PATHS.dest.dist.lib);
}

// ----------------
// Clean dist
gulp.task('clean.dist', (done) => del(['dist'], done));
// ----------------
// Clean test
gulp.task('clean.test', (done) => fse.remove(PATHS.dest.test, done));
// ----------------
// Clean coverage
gulp.task('clean.coverage', (done) => fse.remove(PATHS.dest.coverage, done));
// ----------------
// Clean everything
gulp.task('clean', seq('clean.dist', 'clean.test', 'clean.coverage'));

// ---------------
// Copy vendor etc
gulp.task('copyOnlyLib', () => gulp.src(PATHS.src.vendor.copyOnly)
  .pipe(gulp.dest((file: any) => mapDestPathForLib(file.path)))
);

// ---------------
// Copy vendor css
gulp.task('cssLib', () => gulp.src(PATHS.src.vendor.css)
  .pipe(gulpIf(IS_PROD, sourceMaps.init()))
  .pipe(gulpIf(IS_PROD, cssnano()))
  .pipe(gulpIf(IS_PROD, sourceMaps.write()))
  .pipe(gulp.dest((file: any) => mapDestPathForLib(file.path)))
);