-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
46 lines (38 loc) · 1.09 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
var gulp = require('gulp');
var webserver = require('gulp-webserver');
var watch = require('gulp-watch');
var inject = require('gulp-inject');
var del = require('del');
var packageJson = require('./package.json');
gulp.task('copy_packages', function () {
var modules = Object.keys(packageJson.dependencies);
var moduleFiles = modules.map(function(module) {
return 'node_modules/' + module + '/**';
});
return gulp.src(moduleFiles, { base: 'node_modules' })
.pipe(gulp.dest('dist/assets'));
});
gulp.task('clean', function (cb) {
del.sync(['dist/**', '!dist']);
cb();
});
gulp.task('webserver', function () {
var stream = gulp.src('dist')
.pipe(webserver({
livereload: true,
open: true
}));
return stream;
});
gulp.task('watch', function () {
return gulp.src('www/**/*')
.pipe(watch('www/**/*'))
.pipe(gulp.dest('dist'));
});
gulp.task('copy', function (cb) {
gulp.src('www/**/*')
.pipe(gulp.dest('dist'));
cb();
});
gulp.task('dev', ['clean', 'copy', 'copy_packages', 'watch', 'webserver']);
gulp.task('build', ['clean', 'copy', 'copy_packages']);