-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGulpfile.js
75 lines (61 loc) · 1.7 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
var gulp = require('gulp'),
plumber = require('gulp-plumber'),
sass = require('gulp-sass'),
jade = require('gulp-jade'),
concat = require('gulp-concat'),
livereload = require('gulp-livereload');
gulp.task('html', function() {
return gulp.src('html/**/*.jade')
.pipe(plumber())
.pipe(jade())
.pipe(gulp.dest('dist/'))
});
gulp.task('css', function() {
return gulp.src('css/**/*.scss')
.pipe(plumber())
.pipe(sass())
.pipe(gulp.dest('dist/css'))
});
gulp.task('vendors', function() {
return gulp.src('css/vendors/**/*', {base: '.'})
.pipe(gulp.dest('dist/'))
});
gulp.task('fonts', function() {
return gulp.src('css/fonts/**/*')
.pipe(plumber())
.pipe(gulp.dest('dist/css/fonts/'))
});
gulp.task('js', function() {
return gulp.src('js/**/*.js')
.pipe(plumber())
.pipe(concat('main.js'))
.pipe(gulp.dest('dist/js'))
});
gulp.task('img', function() {
return gulp.src('img/**/*')
.pipe(plumber())
.pipe(gulp.dest('dist/img/'))
});
gulp.task('server', function(next) {
var connect = require('connect'),
http = require("http")
http.createServer(
connect()
.use(require("connect-livereload")())
.use(require("serve-static")('dist/', {etag: false}))
)
.listen(8080);
if(next) {
next();
}
});
gulp.task('watch', function() {
gulp.watch('css/**/*.scss', ['css']);
gulp.watch('js/**/*.js', ['js']);
gulp.watch('html/**/*.jade', ['html']);
gulp.watch('img/**/*', ['img']);
gulp.watch('css/fonts/**/*', ['fonts']);
livereload.listen();
gulp.watch(['dist/**']).on('change', livereload.changed);
});
gulp.task("default", ['html', 'vendors', 'css', 'js', 'img', 'fonts', 'server', 'watch']);