-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
58 lines (42 loc) · 1.65 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
'use strict';
const gulp = require('gulp'),
sass = require('gulp-sass'),
babel = require('gulp-babel'),
uglify = require('gulp-uglify'),
concat = require('gulp-concat');
// compile SASS files
gulp.task('sass', () => {
return gulp.src('./devAssets/sass/styles.sass')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./web/css/'));
});
// compile ES6 to legacy Javascript
gulp.task('compileES6', () => {
return gulp.src([
'./devAssets/Javascript/ES6/lib/types/*.js',
'./devAssets/Javascript/ES6/lib/classes/*.js',
'./devAssets/Javascript/ES6/lib/functions/*.js',
'./devAssets/Javascript/ES6/*.js'
])
.pipe(babel({presets: ['es2015']}))
.pipe(concat('es5.js'))
.pipe(gulp.dest('./devAssets/Javascript/ES6_to_ES5'))
});
// compress all js files into one file
gulp.task('compressAllJS', ['compileES6'], () => {
return gulp.src(['./devAssets/Javascript/ES6/lib/wrapper/start.js', './devAssets/Javascript/ES6_to_ES5/es5.js', './devAssets/Javascript/ES6/lib/wrapper/end.js'])
.pipe(concat('app.js'))
.pipe(gulp.dest('./devAssets/Javascript/ES6_to_ES5/compressed/'));
});
// uglify the compiled ES6
// This gives us a chance to make changes to the compiled ES6 if we need to
gulp.task('uglyJS', ['compressAllJS'], () => {
return gulp.src('./devAssets/Javascript/ES6_to_ES5/compressed/app.js')
.pipe(uglify())
.pipe(gulp.dest('./web/js/'));
});
// watch for sass file changes on save
gulp.task('watch', () => {
gulp.watch(['./devAssets/sass/**/*.sass', './devAssets/Javascript/ES6/**/**/*.js'], ['sass', 'uglyJS']);
});
gulp.task('default', ['sass', 'uglyJS', 'watch']);