client/gulpfile.js
changeset 89 7faa53118457
parent 88 2db951a4a04c
child 91 f7a844a9079e
equal deleted inserted replaced
88:2db951a4a04c 89:7faa53118457
    69     gulp.src(['./bower_components/**/fonts/*'])
    69     gulp.src(['./bower_components/**/fonts/*'])
    70         .pipe(plugins.flatten())
    70         .pipe(plugins.flatten())
    71         .pipe(gulp.dest(buildFolder+'/fonts'));
    71         .pipe(gulp.dest(buildFolder+'/fonts'));
    72 });
    72 });
    73 
    73 
    74 gulp.task('minimify', function(){
    74 gulp.task('minimify', ['scripts', 'css', 'vendorJS', 'vendorCSS'], function(){
    75     gulp.src(buildFolder+'/js/lib.js')
    75     gulp.src(buildFolder+'/js/lib.js')
    76         .pipe(plugins.uglify())
    76         .pipe(plugins.uglify())
    77         .pipe(plugins.rename('lib.min.js'))
    77         .pipe(plugins.rename('lib.min.js'))
    78         .pipe(gulp.dest(buildFolder+'/js'))
    78         .pipe(gulp.dest(buildFolder+'/js'))
    79         .pipe(plugins.filesize());
    79         .pipe(plugins.filesize());
   107 gulp.task('copy-img', function() {
   107 gulp.task('copy-img', function() {
   108     gulp.src('./img/**/*')
   108     gulp.src('./img/**/*')
   109         .pipe(gulp.dest(buildFolder+'/img'));
   109         .pipe(gulp.dest(buildFolder+'/img'));
   110 });
   110 });
   111 
   111 
   112 gulp.task('copy-server', function() {
   112 gulp.task('watch',function(){
       
   113     gulp.watch([
       
   114         buildFolder+'/**/*.html',
       
   115         buildFolder+'/**/*.js',
       
   116         buildFolder+'/**/*.css'
       
   117     ], function(event) {
       
   118         return gulp.src(event.path)
       
   119             .pipe(plugins.connect.reload());
       
   120     });
       
   121     gulp.watch(['./app/**/*.js','!./app/**/*test.js'],['scripts']);
       
   122     gulp.watch(['!./app/index.html','./app/**/*.html'],['templates']);
       
   123     gulp.watch('./app/**/*.css',['css']);
       
   124     gulp.watch('./app/index.html',['copy-index']);
       
   125     gulp.watch('./data/**/*',['copy-data']);
       
   126     gulp.watch('./img/**/*',['copy-img']);
       
   127 });
       
   128 
       
   129 
       
   130 gulp.task('connect', function() {
       
   131     plugins.connect.server({
       
   132         root: buildFolder,
       
   133         host: "0.0.0.0",
       
   134     	port: 9000,
       
   135         livereload: true
       
   136     });
       
   137 });
       
   138 
       
   139 gulp.task('default',['connect','scripts','css', 'templates','copy-index','copy-data','copy-img','vendorJS','vendorCSS','vendorFonts','watch']);
       
   140 gulp.task('copy-server', ['scripts','css', 'templates','copy-index','copy-data','copy-img','vendorJS','vendorCSS','vendorFonts','minimify'], function() {
   113     gulp.src(buildFolder+'/img/**/*')
   141     gulp.src(buildFolder+'/img/**/*')
   114         .pipe(gulp.dest(staticFolder+'/img'));
   142         .pipe(gulp.dest(staticFolder+'/img'));
   115     gulp.src(buildFolder+'/fonts/**/*')
   143     gulp.src(buildFolder+'/fonts/**/*')
   116         .pipe(gulp.dest(staticFolder+'/fonts'));
   144         .pipe(gulp.dest(staticFolder+'/fonts'));
   117     gulp.src(buildFolder+'/js/*.js')
   145     gulp.src(buildFolder+'/js/*.js')
   139             }
   167             }
   140         }))
   168         }))
   141     .pipe(gulp.dest(templateFolder+'/templates'));
   169     .pipe(gulp.dest(templateFolder+'/templates'));
   142 });
   170 });
   143 
   171 
   144 gulp.task('watch',function(){
       
   145     gulp.watch([
       
   146         buildFolder+'/**/*.html',
       
   147         buildFolder+'/**/*.js',
       
   148         buildFolder+'/**/*.css'
       
   149     ], function(event) {
       
   150         return gulp.src(event.path)
       
   151             .pipe(plugins.connect.reload());
       
   152     });
       
   153     gulp.watch(['./app/**/*.js','!./app/**/*test.js'],['scripts']);
       
   154     gulp.watch(['!./app/index.html','./app/**/*.html'],['templates']);
       
   155     gulp.watch('./app/**/*.css',['css']);
       
   156     gulp.watch('./app/index.html',['copy-index']);
       
   157     gulp.watch('./data/**/*',['copy-data']);
       
   158     gulp.watch('./img/**/*',['copy-img']);
       
   159 });
       
   160 
       
   161 
       
   162 gulp.task('connect', function() {
       
   163     plugins.connect.server({
       
   164         root: buildFolder,
       
   165     	port: 9000,
       
   166         livereload: true
       
   167     });
       
   168 });
       
   169 
       
   170 gulp.task('default',['connect','scripts','css', 'templates','copy-index','copy-data','copy-img','vendorJS','vendorCSS','vendorFonts','watch']);
       
   171 gulp.task('copy-server',['scripts','css', 'templates','copy-index','copy-data','copy-img','vendorJS','vendorCSS','vendorFonts','minimify','copy-server']);
       
   172