-
Notifications
You must be signed in to change notification settings - Fork 104
/
gulpfile.js
43 lines (37 loc) · 1.06 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
var gulp = require('gulp')
var browserify = require('browserify')
var eslint = require('gulp-eslint')
var eslintConfig = require('./eslint.json')
var source = require('vinyl-source-stream')
var connect = require('gulp-connect')
var cache = require('gulp-cached')
gulp.task('browserify', function() {
return browserify({
entries: ['./example/example.js'],
debug: true
})
.bundle()
.pipe(source('example.js'))
.pipe(gulp.dest('build'))
})
gulp.task('static', function () {
return gulp.src(['example/**/*.css', 'example/**/*.html'])
.pipe(gulp.dest('build'))
})
gulp.task('server', function() {
connect.server({
root: ['build'],
port: process.env.PORT || 1337
})
})
gulp.task('lint', function () {
return gulp.src(['lib/**/*.js'])
.pipe(cache('linting'))
.pipe(eslint(eslintConfig))
.pipe(eslint.format())
})
gulp.task('default', ['browserify'])
gulp.task('serve', ['static', 'browserify', 'lint', 'server'], function() {
gulp.watch(['example/**/*'], ['static', 'browserify'])
gulp.watch(['lib/**/*'], ['browserify'])
})