forked from RWTreichel/meat-and-colonel
-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
105 lines (94 loc) · 2.79 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
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var cssMin = require('gulp-cssmin');
var concat = require('gulp-concat');
var jshint = require('gulp-jshint');
var nodemon = require('gulp-nodemon');
var sourcemaps = require('gulp-sourcemaps');
var sass = require('gulp-sass');
var rename = require('gulp-rename');
var install = require('gulp-install');
var ngAnnotate = require('gulp-ng-annotate');
// We store the files we want to watch in an object for easy reference
var paths = {
scripts: [
'./client/lib/lodash/lodash.min.js',
'./client/lib/angular/angular.min.js',
'./client/lib/angular-route/angular-route.min.js',
'./client/lib/angular-notify/angular-notify.js',
'./client/app/home/home.js',
'./client/app/grid/grid-module.js',
'./client/app/grid/tilemodel.js',
'./client/app/grid/gridservice.js',
'./client/app/grid/grid-controller.js',
'./client/app/chat/chat.js',
'./client/app/deck/deck.js',
'./client/app/app.js'
],
stylesheets: [
'./client/assets/css/grid-reset.css',
'./client/assets/css/grid.css',
'./client/assets/css/deck.css',
'./client/assets/css/home.css'
],
sass: [
'./client/assets/sass/*.scss'
]
};
gulp.task('scripts', function() {
return gulp.src(paths.scripts)
.pipe(sourcemaps.init())
.pipe(concat('main.js'))
.pipe(ngAnnotate())
.pipe(uglify())
.pipe(rename('main.min.js'))
.pipe(sourcemaps.write())
// Output to app/dist
// TODO: UGLIFY AND RENAME FILE FOR MINIFY VERSION
.pipe(gulp.dest('./client/app/dist'));
});
gulp.task('stylesheets', function() {
return gulp.src(paths.sass)
.pipe(sourcemaps.init())
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./client/assets/css'))
.pipe(concat('main.css'))
.pipe(gulp.dest('./client/assets/dist'))
.pipe(cssMin())
.pipe(rename('main.min.css'))
.pipe(sourcemaps.write())
.pipe(gulp.dest('./client/assets/dist'));
});
gulp.task('test', function() {
return gulp.src([
'./client/app/**/*.js',
'./server/**/*.js'
]).pipe(jshint())
.pipe(jshint.reporter('default'));
});
gulp.task('install', function() {
return gulp.src(['./bower.json'])
.pipe(install());
});
gulp.task('deploy', ['install'], function() {
gulp.start('stylesheets');
gulp.start('scripts');
});
gulp.task('watch', function() {
gulp.watch(paths.scripts, ['scripts']);
gulp.watch(paths.sass, ['stylesheets']);
});
gulp.task('develop', function() {
nodemon({
script: 'app.js',
ext: 'html js css scss',
tasks: ['scripts', 'stylesheets']
}).on('restart', function() {
console.log('restarted nodemon');
});
});
gulp.task('build', function(){
gulp.start('stylesheets');
gulp.start('scripts');
});
gulp.task('default', ['develop', 'watch']);