-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
55 lines (47 loc) · 1.41 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
/*eslint-disable no-console */
'use strict';
var gulp = require('gulp');
var source = require('vinyl-source-stream');
var browserify = require('browserify');
var watchify = require('watchify');
var livereload = require('gulp-livereload');
var babelify = require('babelify');
var babel = require('gulp-babel');
var eslint = require('gulp-eslint');
var connect = require('gulp-connect');
gulp.task('default', ['connect'], function() {
livereload.listen(35729);
var watcher = watchify(browserify({
entries: ['./examples/index.js'],
transform: [babelify],
debug: true,
cache: {}, packageCache: {}, fullPaths: true
}));
watcher.on('update', rebundle);
function rebundle() {
return watcher
.bundle()
.on('error', function(err) { console.log('Error : ' + err.message); })
.pipe(source('bundle.js'))
.pipe(gulp.dest('./examples'))
.pipe(livereload());
}
return rebundle();
});
gulp.task('eslint', function() {
return gulp.src(['lib/**/*.js', 'gulpfile.js'])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failOnError());
});
gulp.task('build', function() {
return gulp.src('./src/highlightable.js')
.pipe(babel())
.pipe(gulp.dest('./'));
});
gulp.task('connect', function() {
connect.server({
root: 'examples',
livereload: true
});
});