-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathgulpfile.js
59 lines (51 loc) · 1.75 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
const gulp = require('gulp');
const imagemin = require('gulp-imagemin');
const uglify = require('gulp-uglify');
const cssmin = require('gulp-cssmin');
const rename = require('gulp-rename');
// Optimize Images
gulp.task('imageMinCoverImage', () =>
gulp.src('src/assets/cover-image.jpg')
.pipe(imagemin())
.pipe(gulp.dest('static/assets/'))
);
gulp.task('imageMinCompanyImages', () =>
gulp.src('src/assets/images/*')
.pipe(imagemin())
.pipe(gulp.dest('static/assets/images/'))
);
gulp.task('imageMinCourseIcon', () =>
gulp.src('src/assets/images/course-icon/*')
.pipe(imagemin())
.pipe(gulp.dest('static/assets/images/course-icon/'))
);
gulp.task('imageMinFeedbacks', () =>
gulp.src('src/assets/images/feedbacks/*')
.pipe(imagemin())
.pipe(gulp.dest('static/assets/images/feedbacks/'))
);
gulp.task('imageMinProjects', () =>
gulp.src('src/assets/images/projects/*')
.pipe(imagemin())
.pipe(gulp.dest('static/assets/images/projects/'))
);
gulp.task('imageMinFavicons', () =>
gulp.src('src/assets/favicon/*.png')
.pipe(imagemin())
.pipe(gulp.dest('static/assets/favicon/'))
);
// Minify JS
gulp.task('minifyJS', function () {
gulp.src('src/assets/js/*.js')
.pipe(uglify())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('static/assets/js/'));
});
// Gulp task to minify CSS files
gulp.task('cssMin', function () {
gulp.src('src/assets/css/*.css')
.pipe(cssmin())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('static/assets/css/'));
});
gulp.task('default', ['imageMinCoverImage', 'imageMinCompanyImages', 'imageMinCourseIcon', 'imageMinFeedbacks', 'imageMinProjects','imageMinFavicons', 'minifyJS', 'cssMin']);