-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
46 lines (38 loc) · 1.08 KB
/
gulpfile.js
File metadata and controls
46 lines (38 loc) · 1.08 KB
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 babel = require('gulp-babel');
var nodemon = require('gulp-nodemon');
var concat = require('gulp-concat');
gulp.task('compile', function() {
return gulp.src('src/**/*.js')
.pipe(babel())
.pipe(gulp.dest('dist'));
});
gulp.task('views', function() {
return gulp.src('views/**/*')
.pipe(gulp.dest('dist/views'));
});
gulp.task('styles', function() {
return gulp.src('styles/**/*.css')
.pipe(concat('all.css'))
.pipe(gulp.dest('dist/static/'));
});
gulp.task('server', ['compile', 'views', 'styles'], function() {
// Start the server at the beginning of the task
server.run(['dist/app.js']);
// Restart the server when file changes
gulp.watch(['dist/**/*.html'], server.notify);
gulp.watch(['dist/**/*.js'], server.notify);
});
gulp.task('serve', function() {
nodemon({
// the script to run the app
script: 'dist/app.js',
ext: 'js'
});
});
gulp.task('watch', function() {
gulp.watch(['styles/**/*.css'], ['styles']);
gulp.watch(['src/**/*.js'], ['compile']);
gulp.watch(['views/**/*'], ['views']);
});
gulp.task('default', ['compile']);