-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
65 lines (54 loc) · 1.3 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// *** dependencies *** //
var gulp = require('gulp');
var jshint = require('gulp-jshint');
var jscs = require('gulp-jscs');
var connect = require('gulp-connect');
var runSequence = require('run-sequence');
// *** tasks *** ///
gulp.task('connect', function () {
connect.server({
root: './src/',
port: 8888,
livereload: true
});
});
gulp.task('html', function () {
gulp.src('./src/*.html')
.pipe(connect.reload());
});
gulp.task('css', function () {
gulp.src('./src/css/*.css')
.pipe(connect.reload());
});
gulp.task('javascript', function () {
gulp.src('./src/**/*.js')
.pipe(connect.reload());
});
gulp.task('jshint', function() {
return gulp.src('./src/**/*.js')
.pipe(jshint({
esnext: true
}))
.pipe(jshint.reporter('jshint-stylish'))
.pipe(jshint.reporter('fail'));
});
gulp.task('style', function() {
return gulp.src('src/**/*.js')
.pipe(jscs())
.pipe(jscs.reporter())
.pipe(jscs.reporter('fail'));
});
gulp.task('watch', function() {
gulp.watch('./src/js/*.js', ['jshint', 'javascript', 'style']);
gulp.watch(['./src/*.html'], ['html']);
gulp.watch(['./src/css/*.css'], ['css']);
});
// *** defailt task *** //
gulp.task('default', function() {
runSequence(
['jshint'],
['style'],
['watch'],
['connect']
);
});