-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathgulpfile.js
87 lines (71 loc) · 2.12 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
var gulp = require('gulp');
var stylish = require('jshint-stylish');
var jshint = require('gulp-jshint');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var less = require('gulp-less');
var path = require('path');
var minifyCSS = require('gulp-minify-css');
var del = require('del');
var karmaServer = require('karma').Server;
var appName = "nupic-visualizations";
var appJS = [
"client/src/app/**/*.js"
];
var externalJS = [
"client/bower_components/angular/angular.min.js",
"client/bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js",
"client/bower_components/dygraphs/dygraph-combined.js",
"client/bower_components/moment/min/moment.min.js",
"client/bower_components/papaparse/papaparse.min.js"
];
gulp.task('default', ['test','build']);
gulp.task('build', ['externaljs', 'appjs', 'less', 'static']);
gulp.task('clean', function() {
return del(['build/*']);
});
gulp.task('appjs', ['clean'], function() {
return gulp.src(appJS)
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(concat('app.js'))
.pipe(uglify())
.pipe(gulp.dest('build'));
});
gulp.task('externaljs', ['clean'], function() {
return gulp.src(externalJS)
.pipe(concat("external.js"))
.pipe(gulp.dest('build'));
});
gulp.task('less', ['clean'], function() {
return gulp.src('client/src/less/stylesheet.less')
.pipe(less({
paths: [
path.join(__dirname, 'client', 'bower_components', 'bootstrap', 'less'),
path.join(__dirname, 'client', 'src', 'less')
]
}))
.pipe(minifyCSS())
.pipe(gulp.dest('build'));
});
var files = [
'client/src/index.html',
'client/src/assets/*'
];
var fonts = ['client/bower_components/bootstrap/fonts/*'];
gulp.task('static', ['assets', 'fonts']);
gulp.task('assets', ['clean'], function(){
return gulp.src(files)
.pipe(gulp.dest('build'))
});
gulp.task('fonts', ['clean'], function(){
return gulp.src(fonts)
.pipe(gulp.dest('build/fonts'))
});
gulp.task('test', function (done) {
new karmaServer({
configFile: __dirname + '/client/test/karma.conf.js',
singleRun: true
}, done).start();
});
// add banner?