forked from jawg/taxonomy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
55 lines (48 loc) · 1.46 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
const cleanCSS = require('gulp-clean-css');
const concat = require('gulp-concat');
const del = require('del');
const gulp = require('gulp');
const riot = require('gulp-riot');
const uglify = require('uglify-es');
const minifier = require('gulp-uglify/composer')(uglify);
const merge = require('stream-series');
const bundleSrc = [
'node_modules/webfontloader/webfontloader.js',
'node_modules/color-operations-ui/src/scripts/color-converter.js',
'src/scripts/taxonomy.js'
];
const bundleRiotSrc = [
'node_modules/riot/riot.min.js',
'node_modules/webfontloader/webfontloader.js',
'node_modules/color-operations-ui/src/scripts/color-converter.js',
'src/scripts/taxonomy.js'
];
const bundle = (sources, destination) => {
return merge(gulp.src(sources), gulp.src('src/tags/*.tag').pipe(riot()))
.pipe(minifier())
.pipe(concat(destination))
.pipe(gulp.dest('dist/'));
}
gulp.task('clean', () => {
return del(['dist']);
});
gulp.task('bundle', () => {
return bundle(bundleSrc, 'taxonomy-bundle.js');
});
gulp.task('bundle+riot', () => {
return bundle(bundleRiotSrc, 'taxonomy-bundle+riot.js');
});
gulp.task('styles', () => {
return gulp.src(['src/*.css'])
.pipe(concat('style.css'))
.pipe(cleanCSS({
compatibility: 'ie8'
}))
.pipe(gulp.dest('dist/'));
});
gulp.task('sources', gulp.parallel(['bundle', 'bundle+riot', 'styles'], (done) => {
done();
}));
gulp.task('build', gulp.series(['clean', 'sources'], (done) => {
done()
}));