forked from ladisays/kanohack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
81 lines (71 loc) · 2.09 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
var browserify = require('browserify'),
bower = require('gulp-bower'),
concat = require('gulp-concat'),
gulp = require('gulp'),
gutil = require('gulp-util'),
jade = require('gulp-jade'),
stylus = require('gulp-stylus'),
nodemon = require('gulp-nodemon'),
path = require('path'),
source = require('vinyl-source-stream');
var paths = {
public: 'public/**',
jade: 'app/**/*.jade',
styles: 'app/styles/styles.styl',
scripts: 'app/**/*.js',
staticFiles: [
'!app/**/*.+(styl|css|js|jade)',
'app/**/*.*'
],
clientTests: [],
serverTests: ['test/server/**/*.js']
};
gulp.task('jade', function() {
gulp.src(paths.jade)
.pipe(jade())
.pipe(gulp.dest('./public/'));
});
gulp.task('styles', function () {
gulp
.src(paths.styles)
.pipe(stylus({
paths: [ path.join(__dirname, 'styles') ]
}))
.pipe(gulp.dest('./public/css'));
});
gulp.task('static-files',function(){
return gulp.src(paths.staticFiles)
.pipe(gulp.dest('public/'));
});
gulp.task('nodemon', function () {
nodemon({ script: 'index.js', ext: 'js', ignore: ['public/**','app/**','node_modules/**'] })
.on('restart', function () {
console.log('>> node restart');
});
});
gulp.task('scripts', function() {
gulp.src(paths.scripts)
.pipe(concat('index.js'))
.pipe(gulp.dest('./public/js'));
});
gulp.task('browserify', function() {
var b = browserify();
b.add('./app/js/application.js');
return b.bundle()
.on('success', gutil.log.bind(gutil, 'Browserify Rebundled'))
.on('error', gutil.log.bind(gutil, 'Browserify Error: in browserify gulp task'))
.pipe(source('index.js'))
.pipe(gulp.dest('./public/js'));
});
gulp.task('watch', function() {
gulp.watch(paths.jade, ['jade']);
gulp.watch(paths.styles, ['styles']);
gulp.watch(paths.scripts, ['browserify']);
});
gulp.task('bower', function() {
// return bower()
// .pipe(gulp.dest('public/lib/'));
});
gulp.task('build', ['bower', 'jade', 'styles', 'browserify', 'static-files']);
gulp.task('production', ['nodemon', 'build']);
gulp.task('default', ['nodemon', 'build', 'watch']);