-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgulpfile.js
38 lines (34 loc) · 882 Bytes
/
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
const gulp = require('gulp');
const replace = require('gulp-replace');
const minify = require('gulp-minify');
const path = require('path');
const zip = require('gulp-zip');
gulp.task('minify', async () => {
gulp
.src(['src/**/*.js'])
.pipe(replace('IS_PRODUCTION = false', 'IS_PRODUCTION = true'))
.pipe(
minify({
ext: {
min: [/\.(.*)\.js$/, '$1.js'],
},
noSource: true,
}),
)
.pipe(gulp.dest('dist'));
});
gulp.task('copy', async () => {
gulp.src(['src/*.json', 'src/*.html', 'src/icons/*']).pipe(
gulp.dest(file => {
const dirname = path.dirname(file.path);
return dirname.replace('src', 'dist');
}),
);
});
gulp.task('build', gulp.parallel('minify', 'copy'));
gulp.task('zip', async () => {
gulp
.src('dist/*')
.pipe(zip('spineedit.zip'))
.pipe(gulp.dest('dist'));
});