-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
74 lines (64 loc) · 2.12 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
72
73
74
var gulp = require('gulp'),
concat = require('gulp-concat'),
sourcemaps = require('gulp-sourcemaps'),
clean = require('gulp-clean'),
runSequence = require('run-sequence'),
minify = require('gulp-minify'),
gls = require('gulp-live-server');;
gulp.task('default', function(callback) {
runSequence('build', 'serve', callback);
});
gulp.task('serve', function() {
var server = gls.static('public', 8080);
server.start();
//use gulp.watch to trigger server actions(notify, start or stop)
gulp.watch(['index.html','app/**/*'], function (file) {
console.log('Notificando');
runSequence('build', function(){
server.notify.apply(server, [file]);
});
});
});
gulp.task('build', function(callback) {
runSequence('build-clean',
['build-scripts', 'build-styles', 'build-scripts-libs', 'build-styles-libs', 'build-html'],
callback);
});
gulp.task('build-scripts', function() {
return gulp.src('app/**/*.js')
.pipe(concat('all.js'))
.pipe(sourcemaps.init())
.pipe(minify())
.pipe(sourcemaps.write())
.pipe(gulp.dest('public/js'));
});
gulp.task('build-scripts-libs', function() {
return gulp.src([
'bower_components/jquery/dist/jquery.min.js',
'bower_components/bootstrap/dist/js/bootstrap.min.js',
'bower_components/angular/angular.min.js',
'bower_components/angular-route/angular-route.min.js',
'bower_components/angular-resource/angular-resource.min.js'
])
.pipe(concat('libs.min.js'))
.pipe(gulp.dest('public/js'));
});
gulp.task('build-styles', function() {
return gulp.src(['app/styles/**/*'])
.pipe(concat('styles.css'))
.pipe(gulp.dest('public/css'));
});
gulp.task('build-styles-libs', function() {
return gulp.src([
'bower_components/bootstrap/dist/css/bootstrap.min.css'
])
.pipe(concat('libs.min.css'))
.pipe(gulp.dest('public/css'));
});
gulp.task('build-html', function() {
return gulp.src(['index.html', 'app/**/*.html', 'app/**/*.png'])
.pipe(gulp.dest('public'));
});
gulp.task('build-clean', function(){
return gulp.src('public').pipe(clean())
});