-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
66 lines (58 loc) · 1.49 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
var gulp = require('gulp'),
connect = require('gulp-connect'),
browserify = require('browserify'),
vueify = require('vueify')
source = require('vinyl-source-stream'),
buffer = require('vinyl-buffer'),
sass = require('gulp-sass'),
livereload = require('gulp-livereload'),
base64 = require('gulp-base64'),
sourcemaps = require('gulp-sourcemaps');
/**
* Start web server
*/
gulp.task('connect', function() {
connect.server({
livereload: true,
root: 'www'
});
});
gulp.task('html', function() {
gulp.src('./www/*.html')
.pipe(connect.reload());
});
gulp.task('javascript', function() {
gulp.src('src/*.js')
.pipe(connect.reload());
});
/**
* Compile sass
*/
gulp.task('sass', function() {
gulp.src('src/scss/*.scss')
.pipe(sass())
.pipe(base64())
.pipe(gulp.dest('www/css'))
.pipe(livereload());
});
/**
* Compile Vue.js
*/
gulp.task('compileVue', function() {
browserify({
entries: 'src/app.js',
debug: true
})
.transform(vueify)
.bundle()
.pipe(source('app.js'))
.pipe(buffer())
.pipe(gulp.dest('www/js/'))
.pipe(livereload());
});
gulp.task('watch', function() {
livereload.listen();
gulp.watch('src/scss/**/*.scss', ['sass']);
gulp.watch(['src/**/*.js', 'src/**/*.vue'], ['compileVue']);
});
gulp.task('default', ['connect', 'watch']);