var gulp = require('gulp');
var uglify = require('gulp-uglify');
var clean = require('gulp-clean-css');
var imagemin = require('gulp-imagemin');
var rename = require('gulp-rename');
var concat = require('gulp-concat');
gulp.task('jscompress', function () {
return gulp.src(['./javascripts/common.js', './javascripts/index.js'])
.pipe(uglify())
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest('./javascripts'))
})
gulp.task('csscompress', function () {
return gulp.src(['./stylesheets/common.css', './stylesheets/index.css'])
.pipe(clean())
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest('./stylesheets'))
})
gulp.task('imagecompress', function () {
return gulp.src(['./images/*.jpg', './images/*.png'])
.pipe(imagemin())
.pipe(gulp.dest('./images'))
})
gulp.task('concatJs', function () {
return gulp.src(['/javascripts/index.js', './javascripts/common.js'])
.pipe(concat('concat.js'))
.pipe(gulp.dest('./javascripts'))
})
gulp.task('auto', function () {
gulp.watch('./javascripts/*.js', ['jscompress']);
gulp.watch('./stylesheets/*.css', ['csscompress']);
})
gulp.task('default', ['jscompress', 'csscompress', 'imagecompress', 'concatJs']);