-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
115 lines (105 loc) · 3.25 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
110
111
112
113
114
115
var gulp = require('gulp'),
path = require('path'),
jade = require('gulp-jade'),
less = require('gulp-less'),
bower = require('gulp-bower'),
karma = require('gulp-karma'),
concat = require('gulp-concat'),
supervisor = require('gulp-supervisor');
var paths = {
jade : 'app/**/*jade',
scripts: ['app/**/*js','app/js/*js'],
public: 'public/**/*.*',
styles: ['app/styles/application.less',
'app/styles/sidenav.less'],
clientTests: [
'public/lib/jquery/dist/jquery.min.js',
'public/lib/angular/angular.min.js',
'public/lib/angular-mocks/angular-mocks.js',
'public/lib/jquery-ui/jquery-ui.min.js',
'public/lib/lodash/lodash.min.js',
'public/lib/angular-route/angular-route.min.js',
'public/lib/moment/min/moment-with-locales.min.js',
'public/lib/angular-ui-router/release/angular-ui-router.min.js',
'public/lib/angular-animate/angular-animate.min.js',
'public/lib/angular-aria/angular-aria.min.js',
'public/lib/angular-material/angular-material.min.js',
'public/lib/velocity/velocity.js',
'public/lib/angularfire/dist/angularfire.min.js',
'public/lib/a0-angular-storage/dist/angular-storage.min.js',
'public/lib/firebase/firebase.js',
'public/lib/eventie/eventie.js',
'public/lib/eventEmitter/EventEmitter.js',
'public/lib/imagesloaded/imagesloaded.js',
'public/lib/angular-cookies/angular-cookies.min.js',
'public/lib/wookmark-jquery/wookmark.min.js',
'public/views/**/*.html',
'public/js/index.js',
'test/client/*.js'
]
};
// gulp runner for templates
gulp.task('jade', function() {
gulp.src(paths.jade)
.pipe(jade())
.pipe(gulp.dest('./public/'));
});
// gulp runner to concat scripts into one file
gulp.task('scripts', function() {
gulp.src(paths.scripts)
.pipe(concat('index.js'))
.pipe(gulp.dest('./public/js'));
});
// gulp runner to concat scripts into one file
gulp.task('less', function () {
gulp.src(paths.styles)
.pipe(less({
paths: [ path.join(__dirname, 'styles') ]
}))
.pipe(gulp.dest('./public/css'));
});
// should run server and watch the files for changes
gulp.task('supervisor', function() {
supervisor('./app.js',{
args: [],
watch: paths.scripts,
ignore: [ "test" ],
pollInterval: 500,
extensions: [ "js","jade" ],
exec: "node",
debug: true,
debugBrk: false,
harmony: true,
noRestartOn: false,
forceWatch: true,
quiet: false
});
});
// gulp runner for the back end tests
gulp.task('server:test', function() {
console.log('here to run server test');
});
// Rerun the task when a file changes
gulp.task('watch', function() {
gulp.watch(paths.scripts,['scripts']);
gulp.watch(paths.jade, ['jade']);
gulp.watch(paths.styles, ['less']);
});
// gulp runner for npm install
gulp.task('bower', function() {
return bower()
.pipe(gulp.dest('public/lib/'));
});
// run the client test with karma
gulp.task('client:test', ['scripts'], function() {
return gulp.src(paths.clientTests)
.pipe(karma({
configFile: 'karma.conf.js',
action: 'run'
}));
});
// default group tasks
gulp.task('heroku:production', ['build']);
// gulp.task('heroku:staging', ['build']);
gulp.task('build', ['bower','scripts','jade', 'less']);
gulp.task('default', ['build', 'supervisor', 'watch']);