-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
49 lines (41 loc) · 1.14 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
var gulp = require('gulp'),
path = require('path'),
EXPRESS_ROOT = path.join(__dirname, 'app');
var startExpress = function() {
var server = require('./server.js');
server({
dir:EXPRESS_ROOT,
port: 8080
});
};
var startLiveReload = function() {
var lr = require('tiny-lr')();
lr.listen(35729);
return lr;
};
var notifyLivereload = function(event, lr) {
var fileName = require('path').relative(EXPRESS_ROOT, event.path);
lr.changed({
body: {
files: [fileName]
}
});
};
var sass = function(srcFile, destFile){
var sass = require('gulp-sass');
gulp.src(srcFile)
.pipe(sass())
.pipe(gulp.dest(destFile));
};
// `gulp.task()` defines task that can be run calling `gulp xyz` from the command line
// The `default` task gets called when no task name is provided to Gulp
gulp.task('default', function () {
startExpress();
var lr = startLiveReload();
var scssSrc = './scss/Style.scss';
var cssDest = './app/css/styles.css';
gulp.watch('app/**', function (event){
notifyLivereload(event, lr);
sass(scssSrc, cssDest);
});
});