-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathgulpfile.js
More file actions
executable file
·61 lines (50 loc) · 1.36 KB
/
gulpfile.js
File metadata and controls
executable file
·61 lines (50 loc) · 1.36 KB
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
var gulp = require('gulp'),
browserSync = require('browser-sync').create(),
nodemon = require('gulp-nodemon'),
plumber = require('gulp-plumber'),
notify = require('gulp-notify'),
compass = require('gulp-compass');
//browser sync
gulp.task('browser-sync', ['nodemon', 'styles'], function() {
browserSync.init(null, {
proxy: 'http://localhost:5000',
files: ['views/**/*.*'],
port: 7000
});
gulp.watch('src/sass/*.scss', ['styles']);
gulp.watch('views/*.*').on('change', browserSync.reload);
});
//restart server with nodemon
gulp.task('nodemon', function (cb) {
var started = false;
return nodemon({
script: 'server.js'
}).on('start', function () {
// to avoid nodemon being started multiple times
if (!started) {
cb();
started = true;
}
});
});
///plumber & notify
var notifyInfo = {
title: 'Gulp'
};
var plumberErrorHandler = {
errorHandler: notify.onError({
title: notifyInfo.title,
message: 'Error: <%= error.message %>'
})
};
///compass
gulp.task('styles', function() {
return gulp.src(['src/sass/**/*.scss'])
.pipe(plumber(plumberErrorHandler))
.pipe(compass({ css: 'src/stylesheets',
sass: 'src/sass',
image: 'src/img'
}))
.pipe(gulp.dest('src/stylesheets'));
});
gulp.task('default', ['browser-sync']);