-
Notifications
You must be signed in to change notification settings - Fork 7
/
gulpfile.js
49 lines (45 loc) · 1.48 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
// gulpfile.js
// This is the config for gulp, which is a task runner.
// It takes all the JS and CSS files and bundles them into one JS file and one CSS file.
// To run: navigate to the root directory of this project and run "gulp"
var gulp = require('gulp');
var concat = require('gulp-concat');
var terser = require('gulp-terser');
var rename = require('gulp-rename');
var concatCss = require('gulp-concat-css');
var cleanCss = require('gulp-clean-css');
// js
gulp.task('scripts', function () {
return gulp
.src([
'./src/js/constants.js',
'./src/js/audio.js',
'./src/js/display.js',
'./src/js/barplot.js',
'./src/js/boxplot.js',
'./src/js/heatmap.js',
'./src/js/scatterplot.js',
'./src/js/histogram.js',
'./src/js/lineplot.js',
'./src/js/segmented.js',
'./src/js/controls.js',
'./src/js/init.js',
]) // order matters here
.pipe(concat('maidr.js'))
.pipe(gulp.dest('dist'))
.pipe(terser())
.pipe(rename({ extname: '.min.js' }))
.pipe(gulp.dest('dist'));
});
// css
gulp.task('styles', function () {
return gulp
.src('src/css/*.css')
.pipe(concatCss('maidr_style.css'))
.pipe(gulp.dest('dist')) // destination folder for unminified version
.pipe(cleanCss())
.pipe(rename({ extname: '.min.css' }))
.pipe(gulp.dest('dist')); // destination folder for minified version
});
// default task now runs both scripts and styles tasks
gulp.task('default', gulp.series('scripts', 'styles'));