-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathgulpfile.js
63 lines (54 loc) · 1.66 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
var gulp = require('gulp'),
connect = require('gulp-connect'),
jshint = require('gulp-jshint'),
concat = require('gulp-concat'),
rename = require('gulp-rename'),
opn = require('opn'),
uglify = require('gulp-uglify'),
jsSrc = [
'./src/wrapper/start.js',
'./src/utils.js',
'./src/const.js',
'./src/List.js',
'./src/MediumEditorList.js',
'./src/wrapper/stop.js'
];
gulp.task('connect', function () {
connect.server({
root: './',
port: 1337,
livereload: true
});
});
gulp.task('html', function () {
return gulp.src('./example.html')
.pipe(connect.reload());
});
gulp.task('scripts', function () {
return gulp.src(jsSrc)
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(concat('all.js'))
.pipe(rename(function (path) {
path.basename = 'medium-editor-list';
}))
.pipe(gulp.dest('build'))
.pipe(connect.reload());
});
gulp.task('build-prod', function () {
return gulp.src(jsSrc)
.pipe(concat('all.js'))
.pipe(uglify())
.pipe(rename(function (path) {
path.basename = 'medium-editor-list-min';
}))
.pipe(gulp.dest('build'));
});
gulp.task('watch', function () {
gulp.watch(['./src/**/*.js'], ['scripts']);
gulp.watch(['./example.html'], ['html']);
});
gulp.task('open', function () {
opn('http://localhost:1337/example.html', {app: ['chrome']});
});
gulp.task('default', ['connect', 'scripts', 'open', 'watch']);