// Include gulp
var gulp = require('gulp');

// Include Our Plugins
var wrap         = require('gulp-wrap');
var autoprefixer = require('gulp-autoprefixer');
var sass         = require('gulp-sass');
var plumber      = require('gulp-plumber');

// Compile our SCSS
gulp.task('scss', function() {
  return gulp.src( 'scss/main.scss')
    .pipe(plumber({
        errorHandler: function (err) {
          console.log(err.formatted);
          this.emit('end');
        }
    }))
    .pipe(sass())
    .pipe(autoprefixer({
      browsers: ['last 3 versions'],
      cascade: false
    }))
    .pipe(wrap('<style type="text/css">\n<%= contents %>\n</style>'))
    .pipe(gulp.dest('css'));
});
//
// gulp.task('wrap', function(){
//   return gulp.src( 'bower_components/lightbox2/dist/css/lightbox.min.css')
//     .pipe(wrap('<style type="text/css">\n<%= contents %>\n</style>'))
//     .pipe(gulp.dest('css'));
// })

// Watch Files For Changes
gulp.task('dev-watch', function() {
  gulp.watch( 'scss/*.scss', ['scss']);
});

// Default Task
gulp.task('default', ['scss']);
