-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
81 lines (69 loc) · 2.54 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
var gulp = require('gulp');
var cp = require('child_process');
var minifyCss = require('gulp-minify-css');
var notify = require("gulp-notify")
var sass = require('gulp-ruby-sass')
;
var bower = require('gulp-bower');
var browserSync = require('browser-sync');
var imagemin = require('gulp-imagemin');
var cache = require('gulp-cache');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var config = require('./gulp-config');
gulp.task('bower', function() {
return bower()
.pipe(gulp.dest(config.bowerDirectory))
});
gulp.task('jekyll-build', ['css','scripts','images','icons','bower'], function (done) {
browserSync.notify(config.messages.jekyllBuild);
return cp.spawn('jekyll', ['build'], {stdio: 'inherit'})
.on('close', done);
});
gulp.task('jekyll-rebuild', ['jekyll-build'], function () {
browserSync.reload();
});
gulp.task('icons', function() {
return gulp.src(config.src.icons)
.pipe(gulp.dest(config.jekyllDest.icons))
.pipe(gulp.dest(config.siteDest.icons));
});
gulp.task('css', function() {
return sass(config.src.sassFile, {
style: 'compressed',
loadPath: [
config.src.sass,
config.bowerDirectory + '/normalize.scss/',
config.bowerDirectory + '/fontawesome/scss',
],
compass: true
})
.pipe(minifyCss())
.pipe(gulp.dest(config.jekyllDest.sass))
.pipe(gulp.dest(config.siteDest.sass))
.pipe(browserSync.stream());
});
gulp.task('scripts', function() {
return gulp.src(config.src.scripts)
.pipe(concat('main.js'))
.pipe(uglify())
.pipe(gulp.dest(config.jekyllDest.scripts))
.pipe(gulp.dest(config.siteDest.scripts));
});
gulp.task('images', function() {
return gulp.src(config.src.images)
.pipe(cache(imagemin({ optimizationLevel: 5, progressive: true, interlaced: true })))
.pipe(gulp.dest(config.jekyllDest.images))
.pipe(gulp.dest(config.siteDest.images));
});
gulp.task('build', ['bower', 'icons', 'images', 'scripts','css','jekyll-build']);
gulp.task('serve', ['build'], function() {
browserSync.init({
server: {
baseDir: "./_site"
}
});
// Start a watch for rebuilds
gulp.watch(config.watchAssetFiles, ['jekyll-rebuild']);
gulp.watch(config.watchHtmlFiles, ['jekyll-rebuild']);
});
gulp.task('default', ['serve']);