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

gulpfile.js (6 issues)

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'),
0 ignored issues
show
Comprehensibility introduced by
Usage of the sequence operator is discouraged, since it may lead to obfuscated code.

The sequence or comma operator allows the inclusion of multiple expressions where only is permitted. The result of the sequence is the value of the last expression.

This operator is most often used in for statements.

Used in another places it can make code hard to read, especially when people do not realize it even exists as a seperate operator.

This check looks for usage of the sequence operator in locations where it is not necessary and could be replaced by a series of expressions or statements.

var a,b,c;

a = 1, b = 1,  c= 3;

could just as well be written as:

var a,b,c;

a = 1;
b = 1;
c = 3;

To learn more about the sequence operator, please refer to the MDN.

Loading history...
The variable connect 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.connect.
Loading history...
6
    browserSync = require('browser-sync'),
0 ignored issues
show
The variable browserSync 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.browserSync.
Loading history...
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'),
0 ignored issues
show
The variable rename 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.rename.
Loading history...
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']);