-
Notifications
You must be signed in to change notification settings - Fork 8
/
Gulpfile.js
69 lines (57 loc) · 1.6 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
var gulp = require('gulp');
var connect = require('gulp-connect');
var flipper = require('gulp-css-flipper');
var merge = require('merge-stream');
var del = require('del');
var cleanCSS = require('gulp-clean-css');
var uglify = require('gulp-uglify');
var sassToCSS = require('gulp-sass');
gulp.task('connect', function() {
connect.server({
root: 'build',
livereload: true,
port: 8080
})
});
gulp.task('clean', function() {
return del('build');
});
gulp.task('watch', function() {
return gulp.watch('src/**/*', ['build']);
});
gulp.task('html', function() {
return gulp.src('src/*.html')
.pipe(gulp.dest('build'))
.pipe(connect.reload());
});
gulp.task('css', function() {
var flip = gulp.src(['src/css/*.css', '!src/css/old-style.css']).pipe(flipper());
var noFlip = gulp.src('src/css/old-style.css');
return merge(flip, noFlip)
.pipe(cleanCSS())
.pipe(gulp.dest('build/css'))
.pipe(connect.reload());
});
gulp.task('scss', function() {
return gulp.src('src/scss/*.scss')
.pipe(sassToCSS({ outputStyle: 'compressed' }))
.pipe(gulp.dest('build/css'))
})
gulp.task('js', function() {
return gulp.src('src/js/*.js')
.pipe(uglify())
.pipe(gulp.dest('build/js'))
.pipe(connect.reload());
});
gulp.task('fonts', function() {
return gulp.src('src/fonts/*')
.pipe(gulp.dest('build/fonts'))
.pipe(connect.reload());
});
gulp.task('images', function() {
return gulp.src('src/images/*')
.pipe(gulp.dest('build/images'))
.pipe(connect.reload());
});
gulp.task('build', ['html', 'css', 'scss', 'js', 'fonts', 'images']);
gulp.task('default', ['connect', 'build', 'watch']);