-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
79 lines (69 loc) · 1.96 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
var gulp = require('gulp')
var concat = require('gulp-concat')
var uglify = require('gulp-uglify');
var sourcemaps = require('gulp-sourcemaps');
var ngAnnotate = require('gulp-ng-annotate');
var templateCache = require('gulp-angular-templatecache');
var jshint = require('gulp-jshint');
var Server = require('karma').Server;
gulp.task('test', function (done) {
new Server({
configFile: __dirname + '/karma.conf.js',
singleRun: true
}, done).start();
});
gulp.task('templates', function(){
return gulp.src(['client/src/**/*.html'])
.pipe(templateCache('templates.module.js', {
module: 'letsrule.templates',
standalone: true
}))
.pipe(gulp.dest('client/src/layout'));
});
gulp.task('js', function () {
gulp.src([
'!client/src/**/*.test.js',
'client/src/**/*.module.js',
'client/src/**/*.js'])
.pipe(sourcemaps.init())
.pipe(concat('app.min.js'))
.pipe(ngAnnotate())
.pipe(uglify())
.pipe(sourcemaps.write('./maps'))
.pipe(gulp.dest('client/dist'))
});
gulp.task('lint', function(){
return gulp.src(['client/src/**/*.js'])
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'));
});
gulp.task('vendor', function(){
return gulp.src([
'client/vendor/node_modules/angular/angular.min.js',
'client/vendor/node_modules/jquery/jquery.min.js',
'client/vendor/node_modules/d3/d3.min.js',
'client/vendor/node_modules/leaflet/dist/leaflet.js'
])
.pipe(concat('vendor.min.js'))
.pipe(gulp.dest('client/dist'))
});
gulp.task('vendor.css', function(){
return gulp.src([
'client/vendor/node_modules/leaflet/dist/leaflet.css'
])
.pipe(concat('vendor.min.css'))
.pipe(gulp.dest('client/dist'));
});
gulp.task('css', function(){
return gulp.src([
'client/src/layout/layout.css',
'client/src/**/*.css'
])
.pipe(concat('app.min.css'))
.pipe(gulp.dest('client/dist'));
});
gulp.task('watch', function () {
gulp.watch('client/src/**/*.html',['templates'])
gulp.watch('client/src/**/*.js', ['js'])
gulp.watch('client/src/**/*.css', ['css'])
});