-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
82 lines (73 loc) · 2.38 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
/* globals require */
/* sudo npm install -g gulp gulp-concat gulp-minify gulp-clean-css */
const gulp = require('gulp');
const concat = require('gulp-concat');
const minify = require('gulp-minify');
const cleanCSS = require('gulp-clean-css');
gulp.task('autobuild', function () {
gulp.watch('src/**', {ignoreInitial: false}, gulp.series('build'));
});
gulp.task('build', function () {
/* build api + trans */
gulp.src([
'dist/locales/*.js',
'src/ms-api.js'
])
.pipe(concat('dist/ms-api.js'))
.pipe(minify({
ext: { src: '.tmp.js', min: '.min.js' },
compress: { 'hoist_vars': true }
}))
.pipe(gulp.dest('.'));
/* build tree */
gulp.src([
'src/ms-tree.js'
])
.pipe(concat('dist/ms-tree.js'))
.pipe(minify({
ext: { src: '.tmp.js', min: '.min.js' },
compress: { 'hoist_vars': true }
}))
.pipe(gulp.dest('.'));
/* build browser */
gulp.src([
'src/ms-browser*.js'
])
.pipe(concat('dist/ms-browser.js'))
.pipe(minify({
ext: { src: '.tmp.js', min: '.min.js' },
compress: { 'hoist_vars': true }
}))
.pipe(gulp.dest('.'));
/* build browser + tree + api + trans */
gulp.src([
'dist/locales/*.js',
'src/*.js'
])
.pipe(concat('dist/ms-full.js'))
.pipe(minify({
ext: { src: '.tmp.js', min: '.min.js' },
compress: { 'hoist_vars': true }
}))
.pipe(gulp.dest('.'));
/* build MS specific css */
gulp.src(['src/css/ms-catalog.css'])
.pipe(concat('dist/ms-catalog.min.css'))
.pipe(cleanCSS({ compatibility: 'ie8' }))
.pipe(gulp.dest('.'));
/* build items css */
gulp.src(['src/css/ms-items.css'])
.pipe(concat('dist/ms-items.min.css'))
.pipe(cleanCSS({ compatibility: 'ie8' }))
.pipe(gulp.dest('.'));
/* build browser css */
gulp.src(['src/css/ms-browser.css'])
.pipe(concat('dist/ms-browser.min.css'))
.pipe(cleanCSS({ compatibility: 'ie8' }))
.pipe(gulp.dest('.'));
/* build browser + items css (excluding catalog css) */
return gulp.src(['src/css/ms-items.css', 'src/css/ms-browser.css'])
.pipe(concat('dist/ms-full.min.css'))
.pipe(cleanCSS({ compatibility: 'ie8' }))
.pipe(gulp.dest('.'));
});