-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
100 lines (82 loc) · 3.54 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
88
89
90
91
92
93
94
95
96
97
98
99
var gulp = require('gulp'),
sass = require('gulp-ruby-sass'),
autoprefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-minify-css'),
jshint = require('gulp-jshint'),
imagemin = require('gulp-imagemin'),
rename = require('gulp-rename'),
concat = require('gulp-concat'),
notify = require('gulp-notify'),
cache = require('gulp-cache'),
livereload = require('gulp-livereload'),
del = require('del');
sourcemaps = require('gulp-sourcemaps');
foreach = require('gulp-foreach');
out = require('gulp-out');
uglifycss = require('gulp-uglifycss');
changed = require('gulp-changed');
let uglify = require('gulp-uglify-es').default;
gulp.task('3dhop', function() {
return gulp.src(["./assets/3dviewer/js/spidergl.js", "./assets/3dviewer/js/presenter.js", "./assets/3dviewer/js/ply.js", "./assets/3dviewer/js/trackball_pantilt.js", "./assets/3dviewer/js/trackball_sphere.js","./assets/3dviewer/js/trackball_turntable.js","./assets/3dviewer/js/trackball_turntable_pan.js", "./assets/3dviewer/js/init.js"])
.pipe(sourcemaps.init())
.pipe(uglify())
.pipe(concat('3dviewer.min.js'))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest("./assets/3dviewer/js/"));
});
gulp.task('webRTI', function() {
return gulp.src(["./assets/webViewer/spidergl/spidergl.js", "./assets/webViewer/spidergl/multires.js"])
.pipe(sourcemaps.init())
.pipe(uglify())
.pipe(concat('webrti.min.js'))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest("./assets/webViewer/js/"));
});
gulp.task('basicFiles', function() {
return gulp.src(["./assets/js/serializeForm.js", "./assets/js/dateWidget.js", "./assets/js/template.js", "./assets/js/advancedSearchForm.js", "./assets/js/multiselectWidget.js"])
.pipe(sourcemaps.init())
.pipe(uglify())
.pipe(concat('serializeDateTemplate.min.js'))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest("./assets/minifiedjs/"));
});
gulp.task('assetMaster', function() {
return gulp.src(["./assets/js/assetView.js", "./assets/js/drawers.js"])
.pipe(sourcemaps.init())
.pipe(uglify())
.pipe(concat('assetMaster.min.js'))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest("./assets/minifiedjs/"));
});
gulp.task('searchMaster', function() {
return gulp.src(["./assets/js/search.js", "./assets/js/searchForm.js"])
.pipe(sourcemaps.init())
.pipe(uglify())
.pipe(concat('searchMaster.min.js'))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest("./assets/minifiedjs/"));
});
gulp.task("allJSFilesIndividually", function() {
return gulp.src('./assets/js/*.js')
.pipe(changed('./assets/minifiedjs/', {extension: '.min.js'}))
.pipe(sourcemaps.init())
.pipe(uglify())
.pipe(rename({
extname: '.min.js'
}))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest("./assets/minifiedjs/"));
});
gulp.task("allCSSFilesIndividually", function() {
return gulp.src('./assets/css/*.css')
.pipe(changed('./assets/minifiedcss/', {extension: '.min.css'}))
.pipe(sourcemaps.init())
.pipe(uglifycss())
.pipe(rename({
extname: '.min.css'
}))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest("./assets/minifiedcss/"));
});
gulp.task('default', gulp.series('3dhop', 'webRTI', 'basicFiles', 'basicFiles', 'assetMaster', 'searchMaster', 'allJSFilesIndividually','allCSSFilesIndividually'));
gulp.task('pre-commit', gulp.series('default'));