-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
49 lines (40 loc) · 1.15 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
var gulp = require('gulp');
var sass = require('gulp-sass');
var plumber = require('gulp-plumber');
var livereload = require('gulp-livereload');
var runSeq = require('run-sequence');
var rename = require('gulp-rename');
var browserify = require('browserify');
var babelify = require('babelify');
var source = require('vinyl-source-stream');
//build everything
gulp.task('build', function() {
runSeq(['buildJS'], ['buildCSS']);
});
gulp.task('buildJS', function() {
var bundler = browserify();
bundler.add('./js/main.js');
bundler.transform(babelify);
return bundler.bundle()
.pipe(source('main.js'))
.pipe(plumber())
.pipe(gulp.dest('./public'))
.pipe(livereload());
});
gulp.task('buildCSS', function() {
return gulp.src('./scss/main.scss')
.pipe(plumber())
.pipe(sass())
.pipe(rename('style.css'))
.pipe(gulp.dest('./public'))
.pipe(livereload());
});
gulp.task('default', function() {
livereload.listen();
gulp.watch('scss/**/*.scss', ['buildCSS']);
gulp.watch('js/**/*.js', ['buildJS']);
//watch for changes in index.html and reload
gulp.watch('./index.html', function() {
livereload.reload();
})
});