-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
94 lines (80 loc) · 2.43 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
var gulp = require('gulp'),
htmlmin = require('gulp-htmlmin'),
uglify = require("gulp-uglify"),
cssnano = require('gulp-cssnano'),
concat = require("gulp-concat"),
rename = require('gulp-rename'),
imagemin = require('gulp-imagemin'),
pngquant = require('imagemin-pngquant'),
order = require('gulp-order'),
babel = require('gulp-babel'),
del = require('del');
gulp.task('clean', function() {
del(['dist/*']);
});
gulp.task('images', function() {
gulp.src(['src/assets/*.png'])
.pipe(gulp.dest('dist/assets'));
gulp.src('src/assets/css/images/*')
.pipe(gulp.dest('dist/assets/css/images'));
return gulp.src('src/images/*')
.pipe(imagemin({
progressive: true,
svgoPlugins: [{ removeViewBox: false }],
use: [pngquant()]
}))
.pipe(gulp.dest('dist/assets/images'));
});
gulp.task('fonts', function() {
return gulp.src([
'src/assets/fonts/MaterialIcons-Regular.*'
])
.pipe(gulp.dest('dist/assets/fonts/'));
});
gulp.task('sound', function() {
return gulp.src([
'src/sound/*.mp3'
])
.pipe(gulp.dest('dist/assets/sound/'));
});
gulp.task('jsmin', function() {
gulp.src('./src/assets/js/*.js')
// .pipe(uglify())
.pipe(babel({
presets: ['env']
}))
.pipe(gulp.dest('./dist/assets/js'));
return gulp.src('./src/assets/vendor/*.js')
.pipe(order([
'jquery*.js',
'adapter.js',
'popper.js',
'bootstrap-material-design.min.js',
'*.js'
]))
.pipe(concat("vendor-all.js"))
// .pipe(uglify())
.pipe(rename('vendor-bundle.js'))
.pipe(gulp.dest('./dist/assets/js'));
});
gulp.task('cssmin', function() {
return gulp.src('./src/assets/css/*.css')
.pipe(order([
'font-awesome.min.css',
'bootstrap.css'
]))
.pipe(concat('all-styles.css'))
//.pipe(cssnano())
.pipe(rename('bundle.css'))
.pipe(gulp.dest('./dist/assets/css'));
});
gulp.task('htmlmin', function() {
return gulp.src('src/*.html')
.pipe(htmlmin({ collapseWhitespace: true }))
.pipe(gulp.dest('./dist'))
});
gulp.task('watch', function() {
gulp.watch('src/**/*', ['build']);
});
gulp.task("build", ['jsmin', 'cssmin', 'htmlmin', 'images', 'fonts', 'sound']);
gulp.task("default", ['watch']);