add order in tasks to be sure 'copy-server' task copy the files after building them
authorrougeronj
Fri, 22 May 2015 12:35:53 +0200
changeset 89 7faa53118457
parent 88 2db951a4a04c
child 90 faf2cdb47813
add order in tasks to be sure 'copy-server' task copy the files after building them
client/gulpfile.js
--- a/client/gulpfile.js	Thu May 21 11:07:34 2015 +0200
+++ b/client/gulpfile.js	Fri May 22 12:35:53 2015 +0200
@@ -71,7 +71,7 @@
         .pipe(gulp.dest(buildFolder+'/fonts'));
 });
 
-gulp.task('minimify', function(){
+gulp.task('minimify', ['scripts', 'css', 'vendorJS', 'vendorCSS'], function(){
     gulp.src(buildFolder+'/js/lib.js')
         .pipe(plugins.uglify())
         .pipe(plugins.rename('lib.min.js'))
@@ -109,7 +109,35 @@
         .pipe(gulp.dest(buildFolder+'/img'));
 });
 
-gulp.task('copy-server', function() {
+gulp.task('watch',function(){
+    gulp.watch([
+        buildFolder+'/**/*.html',
+        buildFolder+'/**/*.js',
+        buildFolder+'/**/*.css'
+    ], function(event) {
+        return gulp.src(event.path)
+            .pipe(plugins.connect.reload());
+    });
+    gulp.watch(['./app/**/*.js','!./app/**/*test.js'],['scripts']);
+    gulp.watch(['!./app/index.html','./app/**/*.html'],['templates']);
+    gulp.watch('./app/**/*.css',['css']);
+    gulp.watch('./app/index.html',['copy-index']);
+    gulp.watch('./data/**/*',['copy-data']);
+    gulp.watch('./img/**/*',['copy-img']);
+});
+
+
+gulp.task('connect', function() {
+    plugins.connect.server({
+        root: buildFolder,
+        host: "0.0.0.0",
+    	port: 9000,
+        livereload: true
+    });
+});
+
+gulp.task('default',['connect','scripts','css', 'templates','copy-index','copy-data','copy-img','vendorJS','vendorCSS','vendorFonts','watch']);
+gulp.task('copy-server', ['scripts','css', 'templates','copy-index','copy-data','copy-img','vendorJS','vendorCSS','vendorFonts','minimify'], function() {
     gulp.src(buildFolder+'/img/**/*')
         .pipe(gulp.dest(staticFolder+'/img'));
     gulp.src(buildFolder+'/fonts/**/*')
@@ -141,32 +169,3 @@
     .pipe(gulp.dest(templateFolder+'/templates'));
 });
 
-gulp.task('watch',function(){
-    gulp.watch([
-        buildFolder+'/**/*.html',
-        buildFolder+'/**/*.js',
-        buildFolder+'/**/*.css'
-    ], function(event) {
-        return gulp.src(event.path)
-            .pipe(plugins.connect.reload());
-    });
-    gulp.watch(['./app/**/*.js','!./app/**/*test.js'],['scripts']);
-    gulp.watch(['!./app/index.html','./app/**/*.html'],['templates']);
-    gulp.watch('./app/**/*.css',['css']);
-    gulp.watch('./app/index.html',['copy-index']);
-    gulp.watch('./data/**/*',['copy-data']);
-    gulp.watch('./img/**/*',['copy-img']);
-});
-
-
-gulp.task('connect', function() {
-    plugins.connect.server({
-        root: buildFolder,
-    	port: 9000,
-        livereload: true
-    });
-});
-
-gulp.task('default',['connect','scripts','css', 'templates','copy-index','copy-data','copy-img','vendorJS','vendorCSS','vendorFonts','watch']);
-gulp.task('copy-server',['scripts','css', 'templates','copy-index','copy-data','copy-img','vendorJS','vendorCSS','vendorFonts','minimify','copy-server']);
-