-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
55 lines (38 loc) · 1.12 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
// Require
var gulp = require('gulp'),
gutil = require('gulp-util'),
concat = require('gulp-concat'),
connect = require('gulp-connect');
// Setup
var destFolder = 'public/comics/special/400';
// Helpers
function reload (files) {
gulp.src(files.path).pipe(connect.reload());
}
function prettyLog (label, text) {
gutil.log( gutil.colors.bold(" " + label + " | ") + text );
}
function errorReporter (err){
gutil.log( gutil.colors.red("Error: ") + gutil.colors.yellow(err.plugin) );
if (err.message) { prettyLog("message", err.message); }
if (err.fileName) { prettyLog("in file", err.fileName); }
if (err.lineNumber) { prettyLog("on line", err.lineNumber); }
return this.emit('end');
};
// Tasks
gulp.task('server', function () {
connect.server({
root: 'public',
livereload: true
});
});
gulp.task('script', function () {
return gulp.src([ 'src/*.js' ])
.pipe(concat('200.min.js'))
.pipe(gulp.dest('public'));
});
// Register
gulp.task('default', [ 'server', 'script' ], function () {
gulp.watch(['src/*'], ['script']);
gulp.watch(['public/**/*']).on('change', reload);
});