gentelella/gulpfile.js

41 lines
1.1 KiB
JavaScript
Raw Normal View History

2016-05-24 18:53:42 +02:00
var gulp = require('gulp'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
sass = require('gulp-ruby-sass');
var DEST = 'build/';
gulp.task('scripts', function() {
return gulp.src('src/js/*.js')
.pipe(concat('custom.js'))
.pipe(gulp.dest(DEST+'/js'))
.pipe(rename({suffix: '.min'}))
.pipe(uglify())
.pipe(gulp.dest(DEST+'/js'));
});
// TODO: Maybe we can simplify how sass compile the minify and unminify version
var compileSASS = function (filename, options) {
return sass('src/scss/*.scss', options)
.pipe(concat(filename))
2016-05-24 18:53:42 +02:00
.pipe(gulp.dest(DEST+'/css'));
};
gulp.task('sass', function() {
return compileSASS('custom.css', {});
});
gulp.task('sass-minify', function() {
return compileSASS('custom.min.css', {style: 'compressed'});
2016-05-24 18:53:42 +02:00
});
gulp.task('watch', function() {
// Watch .js files
gulp.watch('src/js/*.js', ['scripts']);
// Watch .scss files
gulp.watch('src/scss/*.scss', ['sass', 'sass-minify']);
2016-05-24 18:53:42 +02:00
});
// Default Task
gulp.task('default', ['watch']);