forked from sibartlett/colonizers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
109 lines (93 loc) · 2.57 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
'use strict';
var gulp = require('gulp'),
gulptools = require('./gulptools'),
jshint = require('gulp-jshint'),
jscs = require('gulp-jscs'),
less = require('gulp-less');
// Client
gulp.task('client-styles', function() {
return gulp.src(['./client/less/game.less'])
.pipe(less())
.pipe(gulp.dest('./client/dist/css'));
});
gulp.task('client-jquery-plugins', function() {
return gulptools.bundleJqueryPlugins([
'node_modules/bootstrap/js/modal.js',
'node_modules/bootstrap/js/tab.js',
'node_modules/bootstrap/js/transition.js',
'node_modules/jasny-bootstrap/js/offcanvas.js',
'node_modules/jasny-bootstrap/js/transition.js'
])
.pipe(gulp.dest('temp'));
});
gulp.task('client-lib', ['client-jquery-plugins'], function() {
return gulptools.bundle({
dest: './client/dist/lib.js',
require: gulptools.getBrowserDependencies(),
jquery: './temp/jquery-plugins.js',
options: {
debug: true
}
});
});
function buildClient(watch) {
return gulptools.bundle({
file: './client/lib/index.js',
dest: './client/dist/room.js',
exclude: gulptools.getBrowserDependencies().concat(['jquery-plugins']),
watch: watch,
options: {
debug: true
}
});
}
gulp.task('client-script', function() {
return buildClient();
});
gulp.task('site-styles', function() {
return gulp.src(['./server/less/site.less'])
.pipe(less())
.pipe(gulp.dest('./server/public/css'));
});
gulp.task('site-jquery-plugins', function() {
return gulptools.bundleJqueryPlugins([
'node_modules/bootstrap/js/tab.js',
'node_modules/jasny-bootstrap/js/transition.js'
])
.pipe(gulp.dest('temp'));
});
gulp.task('site-script', ['site-jquery-plugins'], function() {
return gulptools.bundle({
file: './server/client/site.js',
dest: './server/public/site.js',
jquery: './temp/jquery-plugins.js'
});
});
gulp.task('site', ['site-script', 'site-styles']);
gulp.task('hint', function() {
return gulp.src([
'**/*.js',
'!node_modules/**/*.js',
'!spec/**/*.js',
'!client/dist/**/*.js',
'!server/public/**.js'
])
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'));
});
gulp.task('jscs', function() {
return gulp.src([
'**/*.js',
'!node_modules/**/*.js',
'!spec/**/*.js',
'!client/dist/**/*.js',
'!server/public/**.js'
])
.pipe(jscs());
});
gulp.task('watch', ['client-lib'], function() {
buildClient(true);
return gulp.watch(['client/*.less'], ['client-styles']);
});
gulp.task('client', ['client-script', 'client-lib', 'client-styles']);
gulp.task('default', ['client']);