-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
67 lines (61 loc) · 1.95 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
var gulp = require('gulp'),
sourcemaps = require('gulp-sourcemaps'),
concat = require('gulp-concat'),
babel = require('gulp-babel'),
uglify = require('gulp-uglify'),
sass = require('gulp-sass');
var paths = {
resultScripts: [
'static/js/libs/jquery.js',
'static/js/libs/underscore.js',
'static/js/libs/backbone.js',
'static/js/libs/chart.js',
'static/js/init.js',
'static/js/config.js',
'static/js/models.js',
'static/js/views.js',
'static/js/results.js'
],
scripts: [
'static/js/libs/jquery.js',
'static/js/libs/underscore.js',
'static/js/libs/backbone.js',
'static/js/init.js',
'static/js/config.js',
'static/js/models.js',
'static/js/views.js',
'static/js/main.js'
],
styles: [
'static/css/main.scss'
]
};
gulp.task('default', ['compile-styles', 'compile-scripts', 'compile-results']);
gulp.task('compile-styles', function() {
return gulp.src(paths.styles)
.pipe(sourcemaps.init())
.pipe(sass({ outputStyle: 'compressed' }).on('error', sass.logError))
.pipe(sourcemaps.write())
.pipe(gulp.dest('static/css'));
});
gulp.task('compile-scripts', function() {
return gulp.src(paths.scripts)
.pipe(sourcemaps.init())
.pipe(babel({ presets: ['es2015'] }))
.pipe(uglify().on('error', function(err){throw err;}))
.pipe(concat('static/js/main.min.js'))
.pipe(sourcemaps.write())
.pipe(gulp.dest('./'));
});
gulp.task('compile-results', function() {
return gulp.src(paths.resultScripts)
.pipe(sourcemaps.init())
.pipe(babel({ presets: ['es2015'] }))
.pipe(uglify().on('error', function(err){throw err;}))
.pipe(concat('static/js/results.min.js'))
.pipe(sourcemaps.write())
.pipe(gulp.dest('./'));
});
gulp.task('build', function() {
// do build stuff
});