forked from TeamOfUs/guess-and-draw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
60 lines (57 loc) · 1.53 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
var connect = require('gulp-connect'),
gulp = require('gulp'),
less = require('gulp-less'),
gutil = require('gulp-util'),
webpack = require('webpack');
//gulp-uglify
//gulp-minify-css
//gulp-imagemin
gulp.task('webserver', function () {
connect.server({
root: './',
livereload: true
});
});
gulp.task('watch', function () {
gulp.watch('./views/*.html', ['html-reload'])
gulp.watch('./public/stylesheets/*.css', ['less-reload'])
gulp.watch('./public/scripts/*.js', ['js-reload'])
});
gulp.task('html-reload', function () {
gulp.src('./views/*.html')
.pipe(connect.reload());
});
gulp.task('less-reload', ['less'],function () {
gulp.src('./public/stylesheets/*.css')
.pipe(connect.reload());
});
gulp.task('js-reload', ['webpack'],function () {
gulp.src('./public/scripts/dist/*.js')
.pipe(connect.reload());
});
gulp.task('less', function () {
return
gulp.src('./public/stylesheets/*.less')
.pipe(less({
path: './public/stylesheets/'
}))
.pipe(gulp.dest('./public/stylesheets/dist'));
});
gulp.task('webpack', function (cb) {
var config = {
entry: "./public/scripts/client.js",
output: {
path: "./public/scripts/dist",
filename: "game-script.js"
}
};
webpack(config, function (err, stats) {
if (err) {
gutil.log(err);
} else {
gutil.log(stats.toString())
cb();
}
});
});
gulp.task('default', [ 'webpack', 'watch','webserver']);