forked from skgtech/skgtech.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
89 lines (80 loc) · 2.32 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
89
var gulp = require('gulp');
// Loads the plugins without having to list all of them, but you need
// to call them as $.pluginname
var $ = require('gulp-load-plugins')();
var del = require('del');
var browserify = require('browserify');
var browserSync = require('browser-sync');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var reload = browserSync.reload;
var bs;
// Jekyll tasks
gulp.task('jekyll', $.shell.task('jekyll build'));
gulp.task('jekyll-rebuild', ['jekyll'], function () {
reload();
});
gulp.task('clean', del.bind(null, ['_site']));
// JS browserify task
gulp.task('scripts', function () {
var b = browserify({
entries: './_frontapp/app.js',
debug: true
});
return b.bundle()
.pipe(source('app.js'))
.pipe(buffer())
.pipe($.sourcemaps.init({loadMaps: true}))
.pipe($.uglify())
.on('error', $.util.log)
.pipe($.sourcemaps.write('./'))
.pipe(gulp.dest('./assets/js/'));
});
// Styling task
// gulp.task('styles', function () {
// return gulp.src('./_sass/boot.scss')
// .pipe($.sass())
// .pipe($.autoprefixer('last 1 version', { cascade: true }))
// .pipe($.rename('main.css'))
// .pipe(gulp.dest('css'))
// .pipe(gulp.dest('_site/css'))
// // Injects the CSS changes to your browser since Jekyll doesn't rebuild the CSS
// .pipe(reload({stream: true}));
// });
// BrowserSync will serve our site on a local server for us and other devices to use
// It will also autoreload across all devices as well as keep the viewport synchronized
// between them.
gulp.task('serve', ['jekyll'], function () {
bs = browserSync({
notify: true,
// tunnel: '',
server: {
baseDir: '_site'
}
});
});
// Watch everything
gulp.task('watch', function () {
gulp.watch([
'./_includes/**/*.html',
'./_layouts/**/*.html',
'./about/**/*.html',
'./people/**/*.html',
'./projects/**/*.html',
'./startups/**/*.html',
'./*.md',
'./*.html',
'./*.xml',
'./*.txt',
'./css/**/*.scss',
'./_sass/**/*.scss',
'./_frontapp/**/*.js'
],
[
'jekyll-rebuild'
]);
gulp.watch(['./_frontapp/**/*.js'], ['scripts', 'jekyll-rebuild']);
// gulp.watch(['./css/**/*.css'], ['jekyll-rebuild']);
// gulp.watch(['./_sass/**/*.scss'], ['styles']);
});
gulp.task('default', ['serve', 'watch']);