-
Notifications
You must be signed in to change notification settings - Fork 19
/
gulpfile.js
61 lines (52 loc) · 1.81 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
/* eslint-disable linebreak-style */
/* eslint-disable no-undef */
var gulp = require('gulp');
var sass = require('gulp-sass');
var prefix = require('gulp-autoprefixer');
var minify = require('gulp-clean-css');
var rev = require('gulp-rev');
var revCollector = require('gulp-rev-collector');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var del = require('del');
var prefixerOptions = {
overrideBrowserslist: ['last 2 versions']
};
gulp.task('clean', function () {
return del(['./Galileo']);
});
// CSS
gulp.task('css', function () {
return gulp.src('./assets/css/galileo.scss')
.pipe(sass())
.pipe(prefix(prefixerOptions))
.pipe(minify())
.pipe(rev())
.pipe(gulp.dest('./Galileo/assets/'))
.pipe(rev.manifest())
.pipe(gulp.dest('./temp/rev/css'));
});
//JS
gulp.task('js', function () {
return gulp.src(['./assets/js/dplayer.js', './assets/js/galileo.js'])
.pipe(concat('galileo.js'))
.pipe(uglify())
.pipe(rev())
.pipe(gulp.dest('./Galileo/assets/'))
.pipe(rev.manifest())
.pipe(gulp.dest('./temp/rev/js'));
});
gulp.task('md5', function () {
return gulp.src(['./temp/rev/**/*.json', './templates/**/*ml'])
.pipe(revCollector())
.pipe(gulp.dest('./Galileo/templates/'));
});
gulp.task('move', function () {
gulp.src(['./locale/*'])
.pipe(gulp.dest('./Galileo/locale/'));
gulp.src(['./utils.py', './__init__.py', './LICENSE', './README.md'])
.pipe(gulp.dest('./Galileo/'));
return gulp.src(['./assets/statics/**/*'], {base: './assets/statics/'})
.pipe(gulp.dest('./Galileo/assets/'));
});
gulp.task('default', gulp.series('clean', gulp.parallel('css', 'js'), 'md5', 'move'));