-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
80 lines (71 loc) · 1.75 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
68
69
70
71
72
73
74
75
76
77
78
79
80
const {dest, parallel, series, src} = require('gulp');
const babel = require('gulp-babel');
const del = require('del');
const rename = require('gulp-rename');
const replace = require('gulp-replace');
const rollup = require('gulp-better-rollup');
const uglify = require('gulp-uglify-es').default;
const babelOpts = {
'presets': [[
'@babel/env',
{'modules': false, 'targets': {'ie': '11'}},
]],
};
const uglifyOpts = {
compress: true,
mangle: true,
keep_fnames: true,
};
function sources(dir, suffix) {return [
'',
'Classic',
'Material',
'Demo',
].map(el => `${dir}/aria-tabs${el}.${suffix}`);}
function cleanUp() {return del(['dist', 'build']);}
function bundle() {
return src(sources('src', 'mjs'))
.pipe(rollup({}, {format: 'iife'}))
.pipe(rename(function(path) {path.extname = '.js';}))
.pipe(dest('build'));
}
function bundleWithoutSQ() {
return src(sources('src', 'mjs'))
.pipe(rollup(
{external:['../node_modules/shadow-query/shadowQuery.mjs']},
{format: 'esm'}
))
.pipe(uglify(uglifyOpts))
.pipe(replace(
'import $ from"../node_modules/shadow-query/shadowQuery.mjs";',
'import $ from"../shadow-query/shadowQuery.mjs";'
))
.pipe(rename(function(path) {path.extname = '.min.mjs';}))
.pipe(dest('dist'));
}
function minify() {
return src(sources('build', 'js'))
.pipe(uglify(uglifyOpts))
.pipe(rename(function(path) {path.extname = '.min.js';}))
.pipe(dest('dist'));
}
function transpile() {
return src(sources('build', 'js'))
.pipe(babel(babelOpts))
// .pipe(uglify(uglifyOpts))
.pipe(rename(function(path) {path.extname = '.IE.min.js';}))
.pipe(dest('dist'));
}
exports.default = series(
cleanUp,
parallel(
bundleWithoutSQ,
series(
bundle,
parallel(
minify,
transpile
)
)
)
);