Compile JavaScript files into a single file

The project grows up. There are a lot of code lines. I am going to divide it into small files and to compile to a single file injecting it in to the application. I did before. Yes I’ve found gulp file. Help me to turn it right. Thank you.

gulp.task('compile_app', function () {
  gulp.src(['src/**/*.js'])
    .pipe(plumber())
    .pipe(sourcemaps.init())
    .pipe(concat('app.js'))
    .pipe(ngAnnotate())
    //.pipe(uglify())
    .pipe(sourcemaps.write())
    .pipe(gulp.dest('.'));
});

gulp.task('watch', function () {
  watch('src/**/*.js', function (files, cb) {
    gulp.start('compile_app', cb);
  })
  .pipe(plumber());
});

I made.

ionic setup sass

Gulp started to work. I modified gulpfile.js

diff --git a/ionic/gulpfile.js b/ionic/gulpfile.js
index de8502c..0274d57 100644
@@ -8,7 +8,8 @@ var rename = require('gulp-rename');
 var sh = require('shelljs');
 
 var paths = {
-  sass: ['./scss/**/*.scss']
+  sass: ['./scss/**/*.scss'],
+  scripts: ['./www/js/src/**/*.js']
 };
 
 gulp.task('default', ['sass']);
@@ -25,8 +26,14 @@ gulp.task('sass', function(done) {
     .on('end', done);
 });
 
+gulp.task('scripts', function() {
+  return gulp.src(['./www/js/src/init.js'].concat(paths.scripts))
+    .pipe(gulp.dest('./www/js/build'));
+});
+
 gulp.task('watch', function() {
   gulp.watch(paths.sass, ['sass']);
+  gulp.watch(paths.scripts, ['scripts']);
 });
 
 gulp.task('install', ['git-check'], function() {