Completed
Push — master ( a0379d...63d254 )
by Ankit
03:11
created

gulpfile.js (2 issues)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
var gulp = require('gulp'),
2
    gutil = require('gulp-util'),
3
    uglify = require('gulp-uglify'),
4
    concat = require('gulp-concat');
5
    connect = require('gulp-connect-php'),
6
    browserSync = require('browser-sync'),
7
    del = require('del'),
0 ignored issues
show
The variable del seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.del.
Loading history...
8
    rename = require('gulp-rename'),
9
    cssnano = require('gulp-cssnano');
0 ignored issues
show
The variable cssnano seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.cssnano.
Loading history...
10
11
gulp.task('log', function() {
12
  gutil.log('== My First Task ==')
13
});
14
15
16
gulp.task('js', function() {
17
  gulp.src(['public/assests/js/jquery-3.0.0.min.js','public/assests/js/index.js', 'public/assests/js/handlebars.min.js', 'public/assests/js/moment.min.js'])
18
  .pipe(concat('script.js'))
19
  .pipe(rename({ suffix: '.min' }))
20
  .pipe(uglify())
21
  .pipe(gulp.dest('public/dist/js'))
22
  .on('change', browserSync.reload);
23
});
24
25
gulp.task('css', function() {
26
  gulp.src(['public/assests/css/style.css', 'public/assests/css/font-awesome-4.6.3/css/font-awesome.min.css'])
27
  .pipe(concat('style.css'))
28
  .pipe(rename({ suffix: '.min' }))
29
  .pipe(cssnano())
30
  .pipe(gulp.dest('public/dist/css'))
31
  .on('change', browserSync.reload);
32
})
33
34
35
36
gulp.task('connect', function() {
37
  connect.server({
38
    hostname: '127.0.0.1',
39
    port: 3000,
40
    base: '.'
41
  }, function() {
42
    browserSync({
43
      proxy: '127.0.0.1:3000',
44
      port: 8888
45
  });
46
  });
47
});
48
49
gulp.task('watch', function() {
50
  gulp.watch('public/assets/js/*.js', ['js']);
51
  gulp.watch(['views/*.php']).on('change', browserSync.reload);
52
});
53
54
// cleaning build process- run clean before deploy and rebuild files again
55
gulp.task('clean', function() {
56
    return del(['public/dist/js', 'public/dist/css'], { force: true });
57
});
58
59
60
gulp.task('default', ['clean','css', 'js', 'connect', 'watch']);