-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
63 lines (54 loc) · 1.35 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
/* ====================================
* gulpfile.js
* ===================================== */
'use strict';
// Load plugins
var gulp = require('gulp'),
jshint = require('gulp-jshint'),
watch = require('gulp-watch'),
livereload = require('gulp-livereload'),
connect = require('gulp-connect'),
notify = require('gulp-notify');
gulp.task('connect', function() {
connect.server({
root: 'app',
port: '9000',
livereload: true
});
});
gulp.task('reload', function () {
gulp.src('./app/*.html')
.pipe(connect.reload())
.pipe(notify({ message: 'Live reload complete!' }));
});
gulp.task('watch', function () {
gulp.watch([
'./app/*.html',
'./app/styles/**/*.{css,less}',
'./app/scripts/**/*.{js,html}',
'./app/images/**/*.*'
], ['reload']);
// Watch .js files
gulp.watch([
'app/scripts/**/*.js',
'gulpfile.js',
'Gruntfile.js'
], ['scripts']);
// Create LiveReload server
var server = livereload();
});
// Scripts
gulp.task('scripts', function() {
return gulp.src([
'app/scripts/**/*.js',
'gulpfile.js',
'Gruntfile.js'
])
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter('jshint-stylish'))
.pipe(notify({ message: 'Scripts task complete!' }));
});
// Default task
gulp.task('default', ['connect', 'watch'], function() {
gulp.start('scripts');
});