-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
63 lines (57 loc) · 1.71 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
var gulp = require('gulp'),
sass = require('gulp-sass'),
cleanCSS = require('gulp-clean-css'),
rename = require("gulp-rename"),
plumber = require('gulp-plumber'),
gutil = require('gulp-util'),
notify = require('gulp-notify'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify');
//var connect = require('gulp-connect');
var config = {
sassDir: ['./sass/main.scss'],
sassOutputDir: './css/',
sassWatch: './sass/**/*.scss'
}
//keeps gulp from crashing for scss errors & gives sass access to bootstrap
gulp.task('sass', function() {
gulp.src(config.sassDir)
.pipe(plumber({ errorHandler: function(err) {
notify.onError({
title: "Gulp error in " + err.plugin,
message: err.toString()
})(err);
// play a sound once
gutil.beep();
}}))
.pipe(sass())
.pipe(gulp.dest(config.sassOutputDir))
.pipe(rename({
suffix: '.min'
}))
.pipe(cleanCSS())
.pipe(gulp.dest(config.sassOutputDir));
});
gulp.task('scripts', function(){
gulp.src(config.jsDir + '*.js')
.pipe(plumber({ errorHandler: function(err) {
notify.onError({
title: "Gulp error in " + err.plugin,
message: err.toString()
})(err);
// play a sound once
gutil.beep();
}}))
.pipe(concat('app.js'))
.pipe(gulp.dest( config.publicJSCompDir ))
.pipe(rename({
suffix: '.min'
}))
.pipe(uglify())
.pipe(gulp.dest( config.publicJSCompDir ));
});
gulp.task('watch', function() {
gulp.watch(config.sassWatch, ['sass']);
//gulp.watch(config.jsDir + '*.js', ['scripts']);
});
gulp.task('default', ['sass', 'watch']);