﻿var gulp = require('gulp');
var sass = require('gulp-sass');
var path = require('path');
var minifyCss = require("gulp-clean-css");
var uglify = require("gulp-uglify");
var concat = require('gulp-concat');
var del = require('del');
var rename = require('gulp-rename');
var pump = require('pump');

//sass
gulp.task('sass', function () {
    gulp.src('assets/css/**/*.scss')
        .pipe(sass().on('error', sass.logError))
        .pipe(gulp.dest('assets/css'));
});

//CSS Minification
gulp.task('min-css', function () {
    gulp.src(['assets/css/global.css',
                    'assets/lib/loaders.css/loaders.css'])
    .pipe(concat('global.min.css'))
    .pipe(minifyCss())
    .pipe(gulp.dest('assets/css'));
});

//clean scripts
gulp.task('clean-scripts', function () {
    return del('app/app.min.js');
});

//Concat and minification scripts
var jsFiles = [
    'assets/lib/angular/angular.js',
    'assets/lib/angular-animate/angular-animate.js',
    'assets/lib/angular-messages/angular-messages.js',
    'assets/lib/angular-sanitize/angular-sanitize.js',
    'assets/lib/angular-moment/angular-moment.js',
    'assets/lib/moment/moment.js',
    'assets/lib/angular-bootstrap/ui-bootstrap-tpls.js',
    'assets/lib/angular-ui-router/release/angular-ui-router.js',
     'app/app.js',
    'app/**/*.js'
];

gulp.task('scripts', function () {
    pump([
        gulp.src(jsFiles),
        concat('app.min.js'),
        gulp.dest('app'),
        uglify(),
        gulp.dest('app')
    ]);
});

//watchers
gulp.task('watch', function () {
    gulp.watch('assets/css/**/*.scss', ['sass']);
    gulp.watch('assets/css/**/*.css', ['min-css']);
    //gulp.watch(['**/*.js', '!app/app.min.js', '!app/_references.js'], ['scripts']);
})
@@ -294,20 +294,32 @@
 p');%0A%0A//
-sass
+CSS Minification
 %0Agulp.ta
@@ -322,18 +322,21 @@
 p.task('
-sa
+min-c
 ss', fun
@@ -338,32 +338,47 @@
 , function () %7B%0A
+    pump(%5B%0A    
     gulp.src('as
@@ -397,16 +397,17 @@
 *.scss')
+,
 %0A       
@@ -407,22 +407,16 @@
         
-.pipe(
 sass().o
@@ -440,17 +440,17 @@
 ogError)
-)
+,
 %0A       
@@ -446,30 +446,24 @@
 r),%0A        
-.pipe(
 gulp.dest('a
@@ -477,178 +477,18 @@
 ss')
-);%0A%7D);%0A%0A//CSS Minification%0Agulp.task('min-css', function () %7B%0A    gulp.src(%5B'assets/css/global.css',%0A                    'assets/lib/loaders.css/loaders.css'%5D)%0A    .pipe(
+,%0A        
 conc
@@ -507,28 +507,26 @@
 in.css')
-)
+,
 %0A    
-.pipe(
+    
 minifyCs
@@ -532,20 +532,18 @@
 ss()
-)
+,
 %0A    
-.pipe(
+    
 gulp
@@ -561,16 +561,22 @@
 ts/css')
+%0A    %5D
 );%0A%7D);%0A%0A
@@ -1403,58 +1403,8 @@
 ) %7B%0A
-    gulp.watch('assets/css/**/*.scss', %5B'sass'%5D);%0A
     

Combining tasks