-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
54 lines (48 loc) · 1.33 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
var gulp = require('gulp'),
browserSync = require('browser-sync').create(),
bowerFiles = require('main-bower-files'),
inject = require('gulp-inject'),
stylus = require('gulp-stylus'),
es = require('event-stream'),
livereload = require('gulp-livereload');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
gulp.task('inject', function() {
return gulp.src('./web/index.html')
.pipe(inject(gulp.src(bowerFiles(), {read: false}), {name: 'bower'}))
.pipe(inject(gulp.src([
'web/app/app.js',
'web/app/routes/routes.js',
'web/app/modules/**/*.js',
'build/*.js'
],{read: false})))
.pipe(gulp.dest('./web'));
});
gulp.task('watch', function() {
livereload.listen();
//gulp.watch("./web/**/*.js", ['build']);
gulp.watch("./web/**/*.html", browserSync.reload);
});
gulp.task("build", function () {
gulp.src("./web/lib/js-cache/js-cache.js")
.pipe(uglify())
.pipe(rename("js-cache-min.js"))
.pipe(gulp.dest('./build/'));
});
// Static server
gulp.task('serve', ['build', 'inject', 'watch'] , function() {
browserSync.init({
server: {
baseDir: "./web",
routes: {
"/bower_components": "bower_components",
"/static": "static",
"/web": "web",
"/build": "build"
}
},
port : 3003,
ghostMode: false
});
});