-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
87 lines (83 loc) · 1.96 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
81
82
83
84
85
86
87
const gulp = require('gulp');
const terser = require('gulp-terser');
const lightningcss = require('gulp-lightningcss');
const cssnano = require('gulp-cssnano');
const rename = require('gulp-rename');
const sourcemaps = require('gulp-sourcemaps');
function minifyESM() {
return gulp.src('src/js/bell.esm.js')
.pipe(sourcemaps.init())
.pipe(terser({
module: true,
mangle: true
}))
.pipe(rename({
basename: 'bell.esm.min',
extname: '.js'
}))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('dist'));
}
function notMinifyESM() {
return gulp.src('src/js/bell.esm.js')
.pipe(rename({
basename: 'bell.esm',
extname: '.js'
}))
.pipe(gulp.dest('dist'));
}
function minify() {
return gulp.src('src/js/bell.js')
.pipe(sourcemaps.init())
.pipe(terser({
module: false,
mangle: true
}))
.pipe(rename({
basename: 'bell.min',
extname: '.js'
}))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('dist'));
}
function notMinify() {
return gulp.src('src/js/bell.js')
.pipe(rename({
basename: 'bell',
extname: '.js'
}))
.pipe(gulp.dest('dist'));
}
function minifyCSS() {
return gulp.src('src/css/bell.css')
.pipe(sourcemaps.init())
.pipe(lightningcss({
autoprefixer: false,
minify: true
}))
.pipe(cssnano())
.pipe(rename({
basename: 'bell.min',
extname: '.css'
}))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('dist'));
}
function notMinifyCSS(){
return gulp.src('src/css/bell.css')
.pipe(rename({
basename: 'bell',
extname: '.css'
}))
.pipe(gulp.dest('dist'));
}
function minifyThemes(){
return gulp.src('src/themes/**/*.css')
.pipe(lightningcss({
autoprefixer: false,
minify: true
}))
.pipe(cssnano())
.pipe(gulp.dest('dist/themes'))
}
exports.default = gulp.series(minifyCSS,notMinifyCSS, minifyThemes, minify, notMinify,minifyESM,notMinifyESM);