-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.js
57 lines (50 loc) · 1.77 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
var gulp = require('gulp'),
path = require('path'),
less = require('gulp-less'),
uglify = require('gulp-uglify'),
concat = require('gulp-concat'),
autoprefixer = require('gulp-autoprefixer'),
connect = require('gulp-connect'),
shell = require('gulp-shell');
gulp.task('less', function () {
return gulp.src('./src/less/style.less')
.pipe(less({
paths: [ path.join(__dirname, 'src', 'less', 'mixins') ]
}))
.pipe(autoprefixer({
browsers: ['last 3 versions'],
cascade: false
}))
.pipe(gulp.dest('./assets/css'));
});
gulp.task('script', function() {
return gulp.src([
'./src/js/lib/modernizr-3.3.1.min.js',
'./src/js/lib/jquery-1.12.0.js',
'./src/js/lib/lazysizes.min.js',
'./src/js/lib/jquery.waypoints.js',
'./src/js/lib/sticky.js',
'./src/js/script.js'
])
.pipe(concat('script-min.js'))
.pipe(uglify())
.pipe(gulp.dest('assets/js'));
});
gulp.task('jekyll', shell.task(['jekyll build --config _config.yml']));
gulp.task('connect', function() {
connect.server({
root: '_site',
livereload: true
});
});
// Until gulp 4...
gulp.task('jekyll-sync', ['script', 'less'], shell.task(['jekyll build --config _config.yml']));
gulp.task('jekyll-sync-script', ['script'], shell.task(['jekyll build --config _config.yml']));
gulp.task('jekyll-sync-less', ['less'], shell.task(['jekyll build --config _config.yml']));
gulp.task('serve', ['default', 'watch', 'connect']);
gulp.task('watch', function () {
gulp.watch('./src/less/**/*.less', ['less', 'jekyll-sync-less']);
gulp.watch('./src/js/**/*.js', ['script', 'jekyll-sync-script']);
gulp.watch(['./**/*.php', './**/*.html', './**/*.md'], ['jekyll']);
});
gulp.task('default', ['less', 'script', 'jekyll-sync']);