-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
71 lines (60 loc) · 1.6 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
var gulp = require('gulp'),
livereload = require('gulp-livereload'),
watch = require('gulp-watch'),
open = require('open'),
plumber = require('gulp-plumber'),
runSequence = require('run-sequence'),
assets = require('gulp-assets'),
clean = require('gulp-clean'),
nodemon = require('gulp-nodemon');
var IN = "working/",
OUT = "build/";
gulp.task('css', function() {
return gulp.src(IN + "index.html")
.pipe(plumber())
.pipe(assets.css())
.pipe(gulp.dest(OUT));
});
gulp.task('clean', function() {
return gulp.src(OUT)
.pipe(clean());
})
gulp.task('openBrowser', function() {
var port = process.env.PORT || 8000;
open('http://localhost:' + port +'#/home');
})
gulp.task('run', function() {
nodemon({
script: 'server/server.js',
watch: 'server/',
ignore: [ 'server/grammar.js' ],
env: { 'NODE_ENV': 'development' }
});
})
gulp.task('html', function() {
return gulp.src(IN + "**/*.html")
.pipe(plumber())
.pipe(gulp.dest(OUT));
})
gulp.task('js', function() {
return gulp.src(IN + "index.html")
.pipe(plumber())
.pipe(assets.js())
.pipe(gulp.dest(OUT));
});
gulp.task('build', ['css', 'js' , 'html']);
gulp.task('livereload', function() {
livereload.listen();
gulp.watch(IN + "**/*", ["build"]);
gulp.watch(OUT + "**/*", livereload.changed);
})
gulp.task('images', function() {
return gulp.src(IN + "**/*.png")
.pipe(gulp.dest(OUT));
})
gulp.task('dev', function() {
return runSequence('clean', 'images', 'run', 'build','openBrowser', 'livereload');
})
gulp.task('prod', function() {
return runSequence('clean', 'images', 'run', 'build','openBrowser');
})