forked from NSS-Cohort-9/ghpages-workflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gulpfile.js
88 lines (79 loc) · 2.13 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
var gulp = require('gulp'),
$ = require('gulp-load-plugins')({
pattern: ['gulp-*', 'del', 'wiredep', 'main-bower-files']
});
gulp.task('autoprefixer', function () {
return gulp.src('src/**/*.css')
.pipe($.sourcemaps.init())
.pipe($.autoprefixer())
.pipe($.concat('all.css'))
.pipe($.sourcemaps.write('.'))
.pipe(gulp.dest('public/css'));
});
gulp.task('bower', function () {
gulp
.src($.mainBowerFiles('**/*.js'))
.pipe($.concat('build.js'))
.pipe(gulp.dest('public/lib'));
});
gulp.task('babel', function () {
return gulp.src('src/**/*.js')
.pipe($.sourcemaps.init())
.pipe($.babel())
.pipe($.concat('all.js'))
.pipe($.sourcemaps.write('.'))
.pipe(gulp.dest('public/js'));
});
gulp.task('clean', function () {
$.del('public');
});
gulp.task('jade:dev', function () {
gulp
.src(['src/**/*.jade'])
.pipe($.jade({
pretty: true
}))
.pipe(gulp.dest('public'));
});
gulp.task('jade:prod', function () {
gulp
.src(['src/**/*.jade', '!src/**/_*.jade'])
.pipe($.jade())
.pipe(gulp.dest('public'));
});
gulp.task('sass:dev', function () {
gulp
.src('src/_styles/main.scss')
.pipe($.sourcemaps.init())
.pipe($.sass().on('error', $.sass.logError))
.pipe($.sourcemaps.write())
.pipe(gulp.dest('public/css'));
});
gulp.task('sass:prod', function () {
gulp
.src('src/_styles/main.scss')
.pipe($.sass({
outputStyle: 'compressed'
})
.on('error', $.sass.logError)
)
.pipe(gulp.dest('public/css'));
});
gulp.task('build', ['clean', 'jade:prod', 'sass:prod', 'bower']);
//gulp.task('serve', function () {
// $.livereload.listen(8080);
// gulp.watch(['src/**/*.jade'], ['jade:dev']);
// gulp.watch(['src/**/*.scss'], ['sass:dev']);
// gulp.watch(['src/**/*'], ['build']);
//});
gulp.task('connect', function(){
$.connect.server({
root: 'public',
port: 9000,
livereload: true
});
gulp.watch(['src/**/*.jade'], ['jade:dev']);
gulp.watch(['src/**/*.scss'], ['sass:dev']);
gulp.watch(['src/**/*'], ['build']);
});
gulp.task('default', function() {});