Move paths into a config variable
This commit is contained in:
parent
5f53a1d6a1
commit
02dd7cd08a
16
gulpfile.js
16
gulpfile.js
|
@ -3,25 +3,31 @@
|
||||||
var gulp = require('gulp'),
|
var gulp = require('gulp'),
|
||||||
plugins = require('gulp-load-plugins')();
|
plugins = require('gulp-load-plugins')();
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
cssDir: './source/assets/css',
|
||||||
|
imagesDir: './source/assets/images',
|
||||||
|
sassPattern: './sass/**/*.scss'
|
||||||
|
};
|
||||||
|
|
||||||
gulp.task('compass', function () {
|
gulp.task('compass', function () {
|
||||||
gulp.src('./sass')
|
gulp.src('./sass')
|
||||||
.pipe(plugins.compass({
|
.pipe(plugins.compass({
|
||||||
config_file: './config.rb',
|
config_file: './config.rb',
|
||||||
css: './source/assets/css'
|
css: config.cssDir
|
||||||
}))
|
}))
|
||||||
.pipe(plugins.minifyCss())
|
.pipe(plugins.minifyCss())
|
||||||
.pipe(gulp.dest('./source/assets/css'));
|
.pipe(gulp.dest(config.cssDir));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('image', function () {
|
gulp.task('image', function () {
|
||||||
// Minify images.
|
// Minify images.
|
||||||
gulp.src('./source/assets/images/*')
|
gulp.src(imagesDir + '/*')
|
||||||
.pipe(plugins.imagemin())
|
.pipe(plugins.imagemin())
|
||||||
.pipe(gulp.dest('./source/assets/images'));
|
.pipe(gulp.dest(config.imagesDir));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('watch', function () {
|
gulp.task('watch', function () {
|
||||||
gulp.watch('./sass/**/*.scss', ['compass']);
|
gulp.watch(config.sassPattern, ['compass']);
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('default', ['watch']);
|
gulp.task('default', ['watch']);
|
||||||
|
|
Reference in a new issue