'use strict';

var gulp = require('gulp');
var pkg = require('./package.json');
var minifyCSS = require('gulp-minify-css');
var comment = '\/*\r\n* Wing ' + pkg.version + '\r\n* Copyright 2016, Kabir Shah\r\n* http:\/\/kingpixil.github.io\/wing\/\r\n* Free to use under the MIT license.\r\n* http:\/\/www.opensource.org\/licenses\/mit-license.php\r\n*\/\r\n';
var $ = require('gulp-load-plugins')();

gulp.task('build', function () {
  return gulp.src(['./src/top.css', './src/base.css', './src/typography.css', './src/grid.css', './src/buttons.css', './src/forms.css', './src/links.css', './src/lists.css', './src/util.css', './src/misc.css'])
    .pipe($.concat('wing.css'))
    .pipe($.header(comment + '\n'))
    .pipe($.size())
    .pipe(gulp.dest('./dist/'));
});

gulp.task('minify', ['build'], function() {
  return gulp.src(['./dist/wing.css'])
    .pipe(minifyCSS())
    .pipe($.header(comment))
    .pipe($.size())
    .pipe($.concat('wing.min.css'))
    .pipe(gulp.dest('./dist/'));
});

gulp.task('build-gh', function() {
  var content = gulp.src(['./src/top.css', './src/base.css', './src/typography.css', './src/grid.css', './src/buttons.css', './src/forms.css', './src/links.css', './src/lists.css', './src/util.css', './src/misc.css'])
  $.git.checkout('gh-pages', function() {
    return content
      .pipe($.concat('wing.css'))
      .pipe($.header(comment + '\n'))
      .pipe($.size())
      .pipe(gulp.dest('./dist/'));
  });
});

gulp.task('minify-gh', function() {
  var content = gulp.src(['./dist/wing.css']);
  $.git.checkout('gh-pages', function() {
    return content
      .pipe(minifyCSS())
      .pipe($.header(comment))
      .pipe($.size())
      .pipe($.concat('wing.min.css'))
      .pipe(gulp.dest('./dist/'));
  });
});

gulp.task('default', ['build', 'minify']);

gulp.task('watch', function() {
  gulp.watch(['src/*.css'], ['default']);
});

@@ -997,811 +997,8 @@
 );%0A%0A
-gulp.task('build-gh', function() %7B%0A  var content = gulp.src(%5B'./src/top.css', './src/base.css', './src/typography.css', './src/grid.css', './src/buttons.css', './src/forms.css', './src/links.css', './src/lists.css', './src/util.css', './src/misc.css'%5D)%0A  $.git.checkout('gh-pages', function() %7B%0A    return content%0A      .pipe($.concat('wing.css'))%0A      .pipe($.header(comment + '%5Cn'))%0A      .pipe($.size())%0A      .pipe(gulp.dest('./dist/'));%0A  %7D);%0A%7D);%0A%0Agulp.task('minify-gh', function() %7B%0A  var content = gulp.src(%5B'./dist/wing.css'%5D);%0A  $.git.checkout('gh-pages', function() %7B%0A    return content%0A      .pipe(minifyCSS())%0A      .pipe($.header(comment))%0A      .pipe($.size())%0A      .pipe($.concat('wing.min.css'))%0A      .pipe(gulp.dest('./dist/'));%0A  %7D);%0A%7D);%0A%0Agulp.task('default', %5B'build', 'minify'%5D);%0A
 %0Agul
@@ -1068,12 +1068,57 @@
 ult'%5D);%0A%7D);%0A
+%0A%0Agulp.task('default', %5B'build', 'minify'%5D);%0A

remove old gulp commands