/* eslint-env node */

var gulp = require('gulp');
var webpack = require('webpack-stream');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var vulcanize = require('gulp-vulcanize');
var replace = require('gulp-replace');

gulp.task('webpack', function() {
	return gulp.src('components/resume.js')
		.pipe(webpack(
			{ output: { filename: 'scripts.js' }
			, module:
				{ loaders: [ { loader: 'babel-loader' } ] }
			, devtool: 'sourcemap-loader'
			}))
		.pipe(gulp.dest('dist/'));
});

gulp.task('minify', function() {
	return gulp.src('dist/scripts.js')
		.pipe(uglify())
		.pipe(rename('scripts.min.js'))
		.pipe(gulp.dest('dist/'));
});

gulp.task('vulcanize', ['webpack'], function() {
	return gulp.src('index.html')
		.pipe(vulcanize(
			{ inlineScripts: false
			, inlineCss: true
			}))
		.pipe(replace(/"dist\/scripts\.js"/, '"scripts\.min.js"'))
		.pipe(gulp.dest('dist/'))
		.pipe(replace(/"scripts\.min\.js"/, '"scripts.js"'))
		.pipe(rename('index-debug.html'))
		.pipe(gulp.dest('dist/'));
});

@@ -1010,28 +1010,136 @@
 pe(gulp.dest('dist/'));%0A%7D);%0A
+%0Agulp.task('copy-images', function() %7B%0A%09return gulp.src('images/**')%0A%09%09.pipe(gulp.dest('dist/images'));%0A%7D);%0A

copy images during build