This repository has been archived by the owner on Jul 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
59 lines (50 loc) · 1.61 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
'use strict';
var gulp = require('gulp');
var gutil = require('gulp-util');
var plugins = require('gulp-load-plugins')();
var superstatic = require('superstatic');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var http = require('http');
var open = require('open');
plugins.grunt(gulp);
gulp.task('styles', function () {
return gulp.src('styles/main.scss')
.pipe(plugins.sass({
includePaths: require('node-bourbon').includePaths,
errLogToConsole: true
}))
.pipe(gulp.dest('./build/css'));
});
gulp.task('images', function () {
return gulp.src(['images/**/*'])
.pipe(gulp.dest('build/images'));
});
gulp.task('bundle', function () {
return browserify()
.add('./src/index.js')
.transform('partialify')
.bundle()
.pipe(source('app.js'))
.pipe(gulp.dest('build/scripts'));
});
gulp.task('server', function (done) {
var server = superstatic()
.use(require('connect-livereload')())
.listen(function () {
gutil.log('Running on http://localhost:' + server.address().port);
done();
});
});
gulp.task('build', ['grunt-assemble', 'styles', 'images', 'bundle']);
gulp.task('serve', ['build', 'server'], function () {
var livereload = plugins.livereload();
plugins.livereload.listen();
gulp.watch('styles/**/*.scss', ['styles']);
gulp.watch('images/**/*', ['images']);
gulp.watch('src/**/*', ['bundle']);
gulp.watch(['layouts/*', 'pages/**/*', 'partials/**/*'], ['grunt-assemble']);
gulp.watch('build/**/*').on('change', function (file) {
livereload.changed(file.path);
});
});