-
Notifications
You must be signed in to change notification settings - Fork 6
/
gulpfile.js
58 lines (49 loc) · 1.57 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
var browserify = require('browserify'),
babelify = require('babelify'),
buffer = require('vinyl-buffer'),
del = require('del'),
gulp = require('gulp'),
rename = require('gulp-rename'),
source = require('vinyl-source-stream'),
uglify = require('gulp-uglify-es').default;
function clean () {
return del(['build']);
};
function pages () {
return gulp.src('src/*.html')
.pipe(gulp.dest('build'));
};
function libs () {
return gulp.src('src/libs/**')
.pipe(gulp.dest('build/libs'));
};
function deps () {
return browserify('src/dependencies.js')
.add(require.resolve('babel-polyfill'))
.transform('babelify', {presets: ["@babel/preset-env"], plugins:['@babel/plugin-transform-classes']})
.bundle()
.pipe(source('dependencies.js'))
.pipe(buffer())
.pipe(uglify())
.on('error', console.error)
.pipe(gulp.dest('build/'));
};
function module () {
return gulp.src(['./node_modules/@aktivco/rutoken-plugin/rutoken-plugin.min.js'])
.pipe(rename('rutoken-plugin.js'))
.pipe(gulp.dest('build/'));
};
function scripts () {
return gulp.src(['src/present.js', 'src/asn1Utils.js'])
.pipe(gulp.dest('build/'));
};
function styles () {
return gulp.src('src/*.css')
.pipe(gulp.dest('build/'));
};
function images () {
return gulp.src('src/images/*.png')
.pipe(gulp.dest('build/images'));
};
buildScripts = gulp.series(libs, deps, module, scripts)
exports.default = gulp.series(clean, gulp.parallel(pages, buildScripts, styles, images));