-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
59 lines (51 loc) · 1.55 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
var gulp = require('gulp');
var jade = require('gulp-jade');
var less = require('gulp-less');
var lint = require('gulp-jshint');
var jscs = require('gulp-jscs');
var copy = require('gulp-copy');
var paths = {
jadesrc: ['./client/**/*.jade'],
lesssrc: ['./client/**/*.less'],
codesrc: ['./client/**/*.js', './server/**/*.js'],
clientsrc: ['./client/**/*.js', './client/**/*.mp3', './client/**/*.jpg', './client/**/*.wav', './client/**/*.png', './client/**/*.ico'],
jadedst: './public',
lessdst: './public',
clientdst: './public'
};
gulp.task('build', ['jade', 'less', 'lint', 'jscs', 'copy']);
gulp.task('default', ['build', 'watch']);
gulp.task('jade', function() {
gulp.src(paths.jadesrc)
.pipe(jade({pretty: true, doctype: 'html'}))
.on('error', console.error.bind(console))
.pipe(gulp.dest(paths.jadedst));
});
gulp.task('less', function() {
gulp.src(paths.lesssrc)
.pipe(less())
.on('error', console.error.bind(console))
.pipe(gulp.dest(paths.lessdst));
});
gulp.task('lint', function() {
gulp.src(paths.codesrc)
.pipe(lint())
.pipe(lint.reporter('jshint-stylish'));
});
gulp.task('jscs', function() {
gulp.src(paths.codesrc)
.pipe(jscs())
.on('error', function (err) {
console.log(err.message);
this.emit('end');
});
});
gulp.task('copy', function() {
gulp.src(paths.clientsrc)
.pipe(copy(paths.clientdst, {prefix:1}));
});
gulp.task('watch', function() {
gulp.watch(paths.jadesrc, ['jade']);
gulp.watch(paths.lesssrc, ['less']);
gulp.watch(paths.codesrc, ['lint', 'jscs', 'copy']);
});