-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
43 lines (37 loc) · 1.1 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
// Gulp libraries
var gulp = require('gulp'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
babel = require('gulp-babel'),
watch = require('gulp-watch');
// Array of JS files, in order by dependency.
var vendorFiles = [
'node_modules/jquery/dist/jquery.min.js',
'node_modules/d3/build/d3.min.js',
'node_modules/randomcolor/randomcolor.js'
];
var jsFiles = [
'assets/js/src/pfBarChart.js',
'assets/js/src/chart.js',
'assets/js/src/functions.js'
];
// Task to concatinate required vendor JS files.
gulp.task('vendor', function() {
return gulp.src(vendorFiles)
.pipe(concat('siteimprove-vendor.min.js'))
.pipe(gulp.dest('assets/js'));
});
// Task to concatinate and minify custom JS files.
gulp.task('js', function() {
return gulp.src(jsFiles)
.pipe(babel({presets: ['es2015']}))
.pipe(concat('siteimprove.min.js'))
.pipe(uglify())
.pipe(gulp.dest('assets/js'));
});
// Watcher task for JS files.
gulp.task('watch', function() {
gulp.watch('assets/js/*/*.js', ['js']);
});
// Default task
gulp.task('default', ['vendor', 'js', 'watch']);