-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
117 lines (105 loc) · 3.99 KB
/
gulpfile.js
File metadata and controls
117 lines (105 loc) · 3.99 KB
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
116
117
var gulp = require('gulp');
var imagemin = require('gulp-imagemin');
var pngquant = require('imagemin-pngquant');
var sass = require('gulp-sass');
var concat = require('gulp-concat');
var minifycss = require('gulp-minify-css');
var minifyhtml = require('gulp-minify-html');
var cachebreaker = require('gulp-cache-breaker');
var uglify = require('gulp-uglify');
var bower = require('gulp-bower');
var ngAnnotate = require('gulp-ng-annotate');
var connect = require('gulp-connect');
gulp.task('default', ['build']);
gulp.task('build', ['bower','images', 'scripts', 'html', 'styles', 'htaccess']);
gulp.task('bower', function() {
return bower('./bower_components');
});
gulp.task('images', function(){
return gulp.src('web/images/**/*')
.pipe(imagemin({
progressive: true,
svgoPlugins: [{removeViewBox: false}],
use: [pngquant()]
}))
.pipe(gulp.dest('dist/images'));
});
gulp.task('scripts', ['bower'], function() {
return gulp.src([
'bower_components/jquery/dist/jquery.min.js',
'bower_components/bootstrap/dist/js/bootstrap.min.js',
'bower_components/angular/angular.min.js',
'bower_components/angular-route/angular-route.min.js',
'bower_components/angular-resource/angular-resource.min.js',
'bower_components/angular-animate/angular-animate.min.js',
'bower_components/angular-sanitize/angular-sanitize.min.js',
'bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js',
'bower_components/moment/min/moment.min.js',
'bower_components/angular-moment/angular-moment.min.js',
'bower_components/angular-loading-bar/src/loading-bar.js',
'bower_components/ng-file-upload/ng-file-upload-shim.min.js"',
'bower_components/ng-file-upload/ng-file-upload.min.js',
'web/js/main.js',
'web/js/app.js',
'web/js/analyticsService.js',
'web/js/controllers/homepageController.js',
'web/js/controllers/highlightController.js',
'web/js/controllers/contestController.js',
'web/js/controllers/searchController.js',
'web/js/controllers/modalController.js',
'web/js/controllers/replayController.js'
])
.pipe(concat('main.js'))
.pipe(ngAnnotate())
.pipe(uglify())
.pipe(gulp.dest('dist'));
});
gulp.task('styles', ['bower-styles'], function () {
return gulp.src('web/styles/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(concat('main.css'))
.pipe(minifycss())
.pipe(gulp.dest('dist'));
});
gulp.task('bower-styles', ['bower','bower-fonts'], function() {
return gulp.src([
'bower_components/bootstrap/dist/css/bootstrap.min.css',
'bower_components/bootstrap-social/bootstrap-social.css',
'bower_components/font-awesome/css/font-awesome.min.css',
'bower_components/angular-loading-bar/src/loading-bar.css'
])
.pipe(concat('bower-main.css'))
.pipe(minifycss())
.pipe(gulp.dest('dist'));
});
gulp.task('bower-fonts', ['bower'], function() {
return gulp.src([
'bower_components/bootstrap/fonts/glyphicons-halflings-regular.woff',
'bower_components/bootstrap/fonts/glyphicons-halflings-regular.ttf'
])
.pipe(gulp.dest('dist/fonts'));
});
gulp.task('html', function () {
return gulp.src('web/**/*.html')
.pipe(minifyhtml())
.pipe(cachebreaker('dist'))
.pipe(gulp.dest('dist'));
});
gulp.task('htaccess', function() {
return gulp.src('web/.htaccess')
.pipe(gulp.dest('dist'));
});
gulp.task('serve', ['watch'], function() {
connect.server({
root: 'dist',
livereload: true,
fallback: 'dist/index.html'
});
});
gulp.task('watch', ['build'], function() {
gulp.watch('web/.htaccess', ['htaccess']);
gulp.watch('web/**/*.html', ['html']);
gulp.watch('web/styles/*.scss', ['styles']);
gulp.watch(['web/js/*.js', 'web/js/controllers/*.js'], ['scripts']);
gulp.watch('web/images/**/*', ['images']);
});