-
Notifications
You must be signed in to change notification settings - Fork 171
/
Gulpfile.js
64 lines (57 loc) · 1.47 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
var gulp = require('gulp');
var sync = require('run-sequence');
var browser = require('browser-sync');
var webpack = require('webpack-stream');
var todo = require('gulp-todoist');
/*
map of paths for using with the tasks below
*/
var paths = {
entry: 'client/app/app.js',
app: ['client/app/**/*.{js,styl,html}'],
js: 'client/app/**/*!(.spec.js).js',
styl: 'client/app/**/*.styl',
toCopy: ['client/index.html'],
html: ['client/index.html', 'client/app/**/*.html'],
dest: 'dist'
};
gulp.task('todo', function() {
return gulp.src(paths.js)
.pipe(todo({silent: false, verbose: true}));
});
gulp.task('build', ['todo'], function() {
//TODO
/*
fill this task out to take in entry file
and build using the webpack plugin.
the plugin takes the webpack.config as an arg.
be sure to stream the result to the destination path
*/
});
gulp.task('serve', function() {
browser({
port: process.env.PORT || 4500,
open: false,
ghostMode: false,
server: {
baseDir: 'dist'
}
});
});
/*
simple task to copy over needed files to dist
*/
gulp.task('copy', function() {
return gulp.src(paths.toCopy, { base: 'client' })
.pipe(gulp.dest(paths.dest));
});
/*
task to watch files for changes and call build and copy tasks
*/
gulp.task('watch', function() {
gulp.watch(paths.app, ['build', browser.reload]);
gulp.watch(paths.toCopy, ['copy']);
});
gulp.task('default', function(done) {
sync('build', 'copy', 'serve', 'watch', done)
});