-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
76 lines (65 loc) · 1.87 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
var gulp = require('gulp'),
imagemin = require('gulp-imagemin'),
uglify = require('gulp-uglify'),
concat = require('gulp-concat'),
minifyCss = require('gulp-minify-css'),
autoprefixer = require('gulp-autoprefixer'),
plumber = require('gulp-plumber'),
csslint = require('gulp-csslint'),
webserver = require('gulp-webserver');
gulp.task('cssConcat', function() {
gulp.src('./src/css/*.css')
.pipe(plumber())
.pipe(csslint())
.pipe(csslint.reporter())
.pipe(autoprefixer())
.pipe(concat('all.css'))
.pipe(gulp.dest('./dist/css'));
});
gulp.task('cssMin',['cssIE'], function() {
gulp.src('./src/css/*.css')
.pipe(autoprefixer())
.pipe(minifyCss())
.pipe(concat('all.min.css'))
.pipe(gulp.dest('./dist/css'));
});
gulp.task('cssIE', function() {
gulp.src('./src/css/ie/*.css')
.pipe(autoprefixer())
.pipe(gulp.dest('./dist/css'));
});
gulp.task('jsCopy', function() {
gulp.src('./src/js/*.js')
.pipe(gulp.dest('./dist/js'));
});
gulp.task('jsMin', function() {
gulp.src('./src/js/*.js')
.pipe(uglify())
.pipe(gulp.dest('./dist/js'));
});
gulp.task('compressImages', function() {
gulp.src('./src/img/*.*')
.pipe(imagemin({
progressive: true
}))
.pipe(gulp.dest('./dist/img'));
});
gulp.task('fonts', function() {
gulp.src('./src/fonts/*.*')
.pipe(gulp.dest('./dist/fonts'));
});
gulp.task('webserver', function() {
gulp.src('./')
.pipe(webserver({
livereload: true,
open: true
}));
});
gulp.task('build', ['cssMin', 'jsMin', 'compressImages', 'fonts']);
gulp.task('watch', function() {
gulp.watch('./src/css/*.css', ['cssConcat']);
gulp.watch('./src/js/*.js', ['jsMin']);
gulp.watch('./src/fonts/*.*', ['fonts']);
gulp.watch('./src/img/*.*', ['compressImages']);
});
gulp.task('default', ['fonts', 'compressImages', 'cssConcat', 'cssIE', 'jsMin', 'watch', 'webserver']);