var gulp = require('gulp'),
sass = require('gulp-ruby-sass'),
notify = require("gulp-notify"),
bower = require('gulp-bower');
rigger = require('gulp-rigger');
sourcemaps = require('gulp-sourcemaps');
uglify = require('gulp-uglify');
clean = require('gulp-clean');
var config = {
sassPath: './resources/sass',
bowerDir: './bower_components'
};
gulp.task('bower', function() {
return bower()
.pipe(gulp.dest(config.bowerDir))
});
gulp.task('icons', function() {
return gulp.src(config.bowerDir + '/font-awesome/fonts/**.*')
.pipe(gulp.dest('./public/fonts'));
});
gulp.task('css', function() {
return sass(config.sassPath + '/style.scss', {
style: 'nested',
loadPath: [
'./resources/sass',
config.bowerDir + '/bootstrap-sass-official/assets/stylesheets',
config.bowerDir + '/font-awesome/scss'
]
})
.on("error", notify.onError(function (error) {
return "Error: " + error.message;
}))
.pipe(gulp.dest('./public/css'));
});
gulp.task('js', function() {
return gulp.src(config.jsDir + '/main.js', {
loadPath: [
'./resources/js',
config.bowerDir + '/bootstrap-sass-official/assets/javascript']
})
.pipe(rigger())
.pipe(sourcemaps.init())
.pipe(uglify())
.pipe(sourcemaps.write())
.pipe(gulp.dest('./public/js'));
});
gulp.task('watch', function() {
gulp.watch(config.sassPath + '/**/*.scss', ['css']);
});
gulp.task('clean', function () {
return gulp.src('public', {read: false})
.pipe(clean());
});
gulp.task('default', ['bower', 'icons', 'css', 'js']);