-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.js
66 lines (57 loc) · 1.37 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'),
gutil = require('gulp-util'),
autoprefixer = require('gulp-autoprefixer'),
uglify = require('gulp-uglify'),
minify = require('gulp-minify-css'),
path = require('path'),
express = require('express'),
build = gutil.env.gh ? './gh-pages/' : './build/',
uglify = gutil.env.gh ? uglify : gutil.noop,
minify = gutil.env.gh ? minify : gutil.noop;
function onError(err) {
gutil.log(err);
gutil.beep();
this.emit('end');
}
gulp.task('demo:static', function () {
return gulp.src(['demo/*', '!demo/*.css'])
.pipe(gulp.dest(build));
});
gulp.task('demo:css', function () {
return gulp.src('demo/*.css')
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(minify())
.pipe(gulp.dest(build));
});
gulp.task('demo:js', function () {
return gulp.src('demo/*.js')
.pipe(uglify())
.pipe(gulp.dest(build));
});
gulp.task('butter', function () {
return gulp.src('src/*.js')
.pipe(uglify())
.pipe(gulp.dest(build));
});
gulp.task('build', [
'demo:static',
'demo:css',
'demo:js',
'butter'
]);
gulp.task('default', ['build'], function () {
if (!gutil.env.gh) {
gulp.watch(['src/**', 'demo/**'], ['build']);
var
app = express(),
port = 8888;
app.use(express.static(path.resolve(build)));
app.listen(port, function() {
gutil.log('Listening on', port);
});
}
});