forked from hanse/react-calendar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
105 lines (87 loc) · 2.31 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// vim: set sw=4 ts=4 expandtab:
'use strict';
var gulp = require('gulp');
var fs = require('fs');
var stylus = require('gulp-stylus');
var browserify = require('browserify');
var jshint = require('gulp-jshint');
var karma = require('karma').Server;
var jscs = require('gulp-jscs');
var stylish = require('gulp-jscs-stylish');
var jade = require('gulp-pug');
var connect = require('gulp-connect');
gulp.task('stylus', function () {
gulp.src('./examples/*.styl')
.pipe(stylus())
.pipe(gulp.dest('./examples/_build'));
});
gulp.task('watch-stylus', function () {
gulp.watch('./examples/*.styl',
['stylus']);
});
gulp.task('js', function () {
var exampleNames = ['single', 'triple', 'popup'];
exampleNames.forEach(function (name) {
browserify('./examples/' + name + '.js')
.bundle()
.pipe(fs.createWriteStream(
'./examples/_build/' + name + '-bundle.js'));
});
});
gulp.task('watch-js', function () {
gulp.watch(['./lib/*.js', './examples/*.js'],
['js']);
});
gulp.task('watch', ['watch-stylus', 'watch-js']);
gulp.task('dev', ['stylus', 'js', 'watch']);
gulp.task('lint', function () {
gulp.src(['./lib/*.js', './specs/*.js', './examples/*.js'])
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(jshint.reporter('fail'));
});
gulp.task('cs', function () {
gulp.src(['./lib/*.js', './specs/*.js', './examples/*.js'])
.pipe(jscs())
.pipe(stylish.combineWithHintResults())
.pipe(jshint.reporter('default'));
});
gulp.task('specs', function (done) {
var karmaServer = new karma({
configFile: __dirname + '/karma.conf.js',
singleRun: true
}, done);
karmaServer.start();
});
gulp.task('tdd', function (done) {
karma.start({
configFile: __dirname + '/karma.conf.js'
}, done);
});
gulp.task('jade', function () {
gulp.src('./examples/*.jade')
.pipe(jade())
.pipe(gulp.dest('./examples/_build/'));
});
gulp.task('serve', function () {
connect.server({
port: 8888,
root: './examples/_build'
});
});
gulp.task('examples', [
'stylus',
'js',
'jade',
'serve'
]);
gulp.task('test', [
'lint',
'cs',
'specs'
]);
gulp.task('default', [
'stylus',
'js',
'jade'
]);