var gulp = require('gulp'),
    devServer = require('./dev-server.js'),
    gp_concat = require('gulp-concat'),
    gp_rename = require('gulp-rename'),
    gp_bower_files = require('main-bower-files'),
    gp_filter = require('gulp-filter'),
    gp_minify_css = require('gulp-minify-css'),
    gp_uglify = require('gulp-uglify');

gulp.task('connect', function() {
    devServer.run();
});

gulp.task('develop', ['connect', 'watch']);

gulp.task('cssbuild', function() {
    gulp.src(['src/*.png'])
      .pipe(gulp.dest('dist'));
    gulp.src(['vendor/ol.css', 'vendor/highlight/styles/default.css ', 'src/style.css'])
      .pipe(gp_filter('**/*.css'))
      .pipe(gp_concat('wps-gui.css'))
      .pipe(gulp.dest('dist'))
      .pipe(gp_rename('wps-gui.min.css'))
      .pipe(gp_minify_css())
      .pipe(gulp.dest('dist'));
});

gulp.task('jsbuild', function(){
    var bower_files = gp_bower_files();
    // remove w3c-schemas/scripts/w3c-schemas.js
    // see https://github.com/highsource/w3c-schemas/issues/11
    bower_files.pop();
    var files = bower_files.concat([
      'vendor/highlight/highlight.pack.js',
      'components/vkBeautify/vkbeautify.js',
      'components/w3c-schemas/scripts/lib/XLink_1_0.js',
      'components/ogc-schemas/scripts/lib/Filter_1_1_0.js',
      'components/ogc-schemas/scripts/lib/Filter_2_0.js',
      'components/ogc-schemas/scripts/lib/GML_2_1_2.js',
      'components/ogc-schemas/scripts/lib/GML_3_1_1.js',
      'components/ogc-schemas/scripts/lib/OWS_1_0_0.js',
      'components/ogc-schemas/scripts/lib/OWS_1_1_0.js',
      'components/ogc-schemas/scripts/lib/SMIL_2_0.js',
      'components/ogc-schemas/scripts/lib/SMIL_2_0_Language.js',
      'components/ogc-schemas/scripts/lib/WCS_1_1.js',
      'components/ogc-schemas/scripts/lib/WFS_1_1_0.js',
      'components/ogc-schemas/scripts/lib/WPS_1_0_0.js',
      'src/wpsclient.js',
      'src/wpsui.js'
    ]);
    gulp.src(files)
        .pipe(gp_filter('**/*.js'))
        .pipe(gp_concat('wps-gui.js'))
        .pipe(gulp.dest('dist'))
        .pipe(gp_rename('wps-gui.min.js'))
        .pipe(gp_uglify())
        .pipe(gulp.dest('dist'));
});

//gulp.watch('src/*.js', ['jsbuild']);
//gulp.watch(['src/*.css', 'vendor/*.css'], ['cssbuild']);

gulp.task('default', ['jsbuild', 'cssbuild'], function(){});

gulp.task('develop', ['connect', 'jsbuild', 'cssbuild']);

@@ -61,24 +61,63 @@
 erver.js'),%0A
+    connect = require('gulp-connect'),%0A
     gp_conca
@@ -427,53 +427,8 @@
 );%0A%0A
-gulp.task('develop', %5B'connect', 'watch'%5D);%0A%0A
 gulp
@@ -2138,18 +2138,50 @@
 );%0A%7D);%0A%0A
-//
+gulp.task('watch', function() %7B%0A  
 gulp.wat
@@ -2211,66 +2211,228 @@
 d'%5D)
-;%0A//gulp.watch(%5B'src/*.css', 'vendor/*.css'%5D, %5B'cssbuild'%5D
+.on('change', function(f) %7B%0A    gulp.src(%5Bf.path%5D).pipe(connect.reload());%0A  %7D);%0A  gulp.watch(%5B'src/*.css', 'vendor/*.css'%5D, %5B'cssbuild'%5D).on('change', function(f) %7B%0A    gulp.src(%5Bf.path%5D).pipe(connect.reload());%0A  %7D);%0A%7D
 );%0A%0A
@@ -2489,24 +2489,24 @@
 tion()%7B%7D);%0A%0A
-
 gulp.task('d
@@ -2547,12 +2547,21 @@
 ssbuild'
+, 'watch'
 %5D);%0A

proper watch task