var gulp     = require('gulp');
var eslint   = require('gulp-eslint');
var mocha    = require('gulp-mocha-phantomjs');
var header   = require('gulp-header');
var webpack  = require('webpack-stream');
var scsslint = require('gulp-scss-lint');
var sass     = require('gulp-sass');
var pkg      = require('./package.json');

var banner = '/*! <%= pkg.name %> - v<%= pkg.version %> | <%= new Date().getFullYear() %> */\n';

gulp.task('script-test-format', function () {
	return gulp.src(['./src/js/**/*.js'])
		.pipe(eslint())
		.pipe(eslint.format())
		.pipe(eslint.failOnError());
});

gulp.task('script-compile-test', function () {
	return gulp.src(['./test/index.js'])
		.pipe(webpack(require('./webpack.config.js')))
		.pipe(gulp.dest('./test/compiled/'));
});

// Disabled for now
gulp.task('script-test-mocha', ['script-compile-test'], function () {
	return gulp.src(['test/test.html'])
		.pipe(mocha({ reporter: 'spec' }));
});

gulp.task('script-test', ['script-test-format']);

gulp.task('script-build', ['script-test'], function () {
	return gulp.src(['./src/index.js'])
		.pipe(webpack(require('./webpack.config.js')))
		.pipe(header(banner, {
			pkg: pkg,
		}))
		.pipe(gulp.dest('./lib/'));
});

gulp.task('style-build', function () {
	return gulp.src('./src/sass/**/*.scss')
		.pipe(scsslint())
		.pipe(scsslint.failReporter())
		.pipe(sass({
			outputStyle: 'expanded',
		}).on('error', sass.logError))
		.pipe(gulp.dest('./lib'));
});

gulp.task('examples-build', ['script-build', 'style-build'], function () {
	return gulp.src(['./examples/index.js'])
		.pipe(webpack(require('./webpack.config.js')))
		.pipe(gulp.dest('./examples/compiled/'));
});

gulp.task('watch', function () {
	gulp.watch(['./src/js/**/*.js'], ['script-build']);
	gulp.watch(['./src/sass/**/*.scss'], ['style-build']);
});

gulp.task('default', ['script-build', 'style-build']);

@@ -424,26 +424,26 @@
 p.task('
+test-
 scrip
-t-tes
 t-format
@@ -588,23 +588,16 @@
 p.task('
-script-
 compile-
@@ -600,16 +600,23 @@
 ile-test
+-script
 ', funct
@@ -783,31 +783,24 @@
 %0Agulp.task('
-script-
 test-mocha',
@@ -934,34 +934,34 @@
 sk('
+test-
 script
--test', %5B'script-tes
+', %5B'test-scrip
 t-fo
@@ -985,35 +985,35 @@
 sk('
-script-build', %5B'script-tes
+build-script', %5B'test-scrip
 t'%5D,
@@ -1203,27 +1203,27 @@
 p.task('
-style-build
+build-style
 ', funct
@@ -1446,24 +1446,30 @@
 p.task('
+build-
 examples
 -build',
@@ -1464,46 +1464,40 @@
 ples
--build', %5B'
+', %5B'build-
 script
--
+', '
 build
-', '
+-
 style
--build
 '%5D, 
@@ -1719,28 +1719,28 @@
 js'%5D, %5B'
+build-
 script
--build
 '%5D);%0A%09gu
@@ -1776,27 +1776,27 @@
 ss'%5D, %5B'
-style-build
+build-style
 '%5D);%0A%7D);
@@ -1824,35 +1824,35 @@
 , %5B'
+build-
 script
--
+', '
 build
-', '
+-
 style
--build
 '%5D);

Rename tasks in a less awkward way