2016-01-04 11:36:14 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var gulp = require('gulp'),
|
2016-01-05 23:21:51 +00:00
|
|
|
plugins = require('gulp-load-plugins')(),
|
|
|
|
del = require('del');
|
2016-01-04 11:36:14 +00:00
|
|
|
|
2016-01-04 17:11:19 +00:00
|
|
|
var config = {
|
|
|
|
cssDir: './source/assets/css',
|
|
|
|
imagesDir: './source/assets/images',
|
|
|
|
sassPattern: './sass/**/*.scss'
|
|
|
|
};
|
|
|
|
|
2016-01-05 23:13:07 +00:00
|
|
|
gulp.task('styles', function () {
|
2016-01-04 12:20:00 +00:00
|
|
|
gulp.src('./sass')
|
2016-01-04 17:07:01 +00:00
|
|
|
.pipe(plugins.compass({
|
2016-01-04 12:20:00 +00:00
|
|
|
config_file: './config.rb',
|
2016-01-04 23:56:41 +00:00
|
|
|
css: config.cssDir,
|
|
|
|
sourcemap: true
|
2016-01-04 12:20:00 +00:00
|
|
|
}))
|
2016-01-04 17:07:01 +00:00
|
|
|
.pipe(plugins.minifyCss())
|
2016-01-04 17:11:19 +00:00
|
|
|
.pipe(gulp.dest(config.cssDir));
|
2016-01-04 12:20:00 +00:00
|
|
|
});
|
|
|
|
|
2016-01-05 18:57:18 +00:00
|
|
|
gulp.task('images', function () {
|
2016-01-04 11:38:34 +00:00
|
|
|
// Minify images.
|
2016-01-05 18:57:18 +00:00
|
|
|
gulp.src(config.imagesDir + '/*')
|
2016-01-04 17:07:01 +00:00
|
|
|
.pipe(plugins.imagemin())
|
2016-01-04 17:11:19 +00:00
|
|
|
.pipe(gulp.dest(config.imagesDir));
|
2016-01-04 11:36:14 +00:00
|
|
|
});
|
|
|
|
|
2016-01-04 12:20:00 +00:00
|
|
|
gulp.task('watch', function () {
|
2016-01-05 23:13:07 +00:00
|
|
|
gulp.watch(config.sassPattern, ['styles']);
|
2016-01-04 12:20:00 +00:00
|
|
|
});
|
|
|
|
|
2016-01-05 23:21:51 +00:00
|
|
|
gulp.task('clean', function () {
|
|
|
|
del.sync('./source/assets/css/*');
|
|
|
|
del.sync('./output_*/assets/css/*');
|
|
|
|
});
|
|
|
|
|
|
|
|
gulp.task('default', ['clean', 'watch']);
|