-
Notifications
You must be signed in to change notification settings - Fork 7
/
gulpfile.js
56 lines (48 loc) · 1.47 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
var gulp = require('gulp'),
nodemon = require('gulp-nodemon'),
sass = require('gulp-ruby-sass'),
autoprefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-minify-css'),
rename = require('gulp-rename');
//var livereload = require('gulp-livereload');
var livereload = require('tiny-lr')();
function notifyLiveReload(event) {
var fileName = require('path').relative(__dirname, event.path);
livereload.changed({
body: {
files: [fileName]
}
});
}
gulp.task('develop', function() {
livereload.listen(35729);
nodemon({
script: 'server.js',
ext: 'js ejs',
}).on('restart', function() {
setTimeout(function() {
livereload.changed({});
}, 500);
});
});
gulp.task('styles', function() {
return gulp.src('src/sass/*.scss')
.pipe(sass({
style: 'expanded',
compass: true
}))
.pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1'))
.pipe(gulp.dest('public/css'))
.pipe(rename({
suffix: '.min'
}))
.pipe(minifycss())
.pipe(gulp.dest('public/css'));
});
gulp.task('watch', function() {
gulp.watch('src/sass/*.scss', ['styles']);
gulp.watch('app/views/*/*.swig', notifyLiveReload);
gulp.watch('app/views/*.swig', notifyLiveReload);
gulp.watch('public/css/*.css', notifyLiveReload);
});
gulp.task('default', ['develop', 'styles', 'watch']);