-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgulpfile.js
63 lines (54 loc) · 1.35 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
const {
src, dest, parallel, series,
} = require('gulp');
const babel = require('gulp-babel');
const zip = require('gulp-zip');
const tape = require('gulp-tape');
const webpack = require('webpack-stream');
const minifyCSS = require('gulp-csso');
const htmlmin = require('gulp-htmlmin');
const packageJson = require('./package.json');
function html() {
return src('assets/*.html')
.pipe(htmlmin({ collapseWhitespace: true }))
.pipe(dest('dist/dist/'));
}
function css() {
return src('assets/*.css')
.pipe(minifyCSS())
.pipe(dest('dist/dist/'));
}
function cmd() {
return src('cmd/*.js')
.pipe(webpack(require('./webpack.config.js')))
.pipe(dest('dist/dist/'));
}
function manifest() {
return src('manifest.json')
.pipe(dest('dist/'));
}
function buildSrc() {
return src('src/*.js')
.pipe(babel({
presets: ['@babel/env'],
}))
.pipe(dest('test/'));
}
function test() {
return buildSrc()
.pipe(src('test/*.js'))
.pipe(tape({
bail: true,
}));
}
function dist() {
return src('dist/*')
.pipe(zip(`linkedin-profile-filter-${packageJson.version}.zip`))
.pipe(dest('./'));
}
const buildCmd = parallel(html, css, cmd, manifest);
const testCmd = series(buildSrc, test);
exports.test = testCmd;
exports.dist = series(test, buildCmd, dist);
exports.build = buildCmd;
exports.default = buildCmd;