-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
77 lines (66 loc) · 2.05 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
var gulp = require('gulp');
var $ = require('gulp-load-plugins')({lazy: false});
var source = require('vinyl-source-stream');
var browserify = require('browserify');
var argv = require('minimist')(process.argv.slice(2));
var paths = {
dist: './dist',
scripts: {
entry: './app/main.js',
all: './app/**/*.js'
},
static: './web/static/**/*',
staticDir: './web/static',
stylesheets: './web/stylesheets/**/*.sass',
tests: './test/test.js',
webDist: './web_dist'
};
gulp.task('lint', function () {
return gulp.src(paths.scripts.all)
.pipe($.jshint())
.pipe($.jshint.reporter('default'));
});
gulp.task('scripts', ['lint'], function () {
return browserify(paths.scripts.entry, { standalone: 'tappy' })
.bundle()
.pipe(source('tappy.js'))
.pipe(gulp.dest(paths.dist))
.pipe($.rename('tappy.min.js'))
.pipe($.streamify( $.uglify() ))
.pipe(gulp.dest(paths.dist));
});
gulp.task('sass', function () {
return gulp.src(paths.stylesheets)
.pipe($.rubySass({ "sourcemap=none": true }))
.pipe($.autoprefixer())
.pipe(gulp.dest(paths.staticDir));
});
gulp.task('buildWeb', ['sass'], function () {
return gulp.src(paths.static)
.pipe(gulp.dest(paths.webDist));
});
gulp.task('watch', function () {
gulp.watch([paths.scripts.all], ['lint', 'scripts', 'test']);
});
gulp.task('watchWeb', function () {
gulp.watch([paths.scripts.all], ['lint', 'scripts', 'test']);
gulp.watch([paths.stylesheets, paths.static], ['buildWeb']);
});
gulp.task('webserver', function () {
gulp.src(paths.webDist)
.pipe($.webserver({
host: '0.0.0.0',
livereload: true,
open: true
}));
});
gulp.task('test', ['scripts'], function () {
return gulp.src(paths.tests, {read: false})
.pipe($.mocha({reporter: 'nyan'}));
});
gulp.task( 'default', [ 'lint', 'scripts', 'test', 'watch' ] );
gulp.task( 'web', [ 'sass', 'buildWeb', 'webserver', 'watchWeb' ] );
gulp.task('deploy', ['buildWeb'], function () {
gulp.src(paths.webDist + '/**/*')
.pipe($.ghPages('https://github.com/rileyjshaw/tappy.git', 'origin'));
});