This repository has been archived by the owner on Apr 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
59 lines (45 loc) · 1.4 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
var gulp = require('gulp'),
compass = require('gulp-compass'),
bSync = require('browser-sync'),
nodemon = require('gulp-nodemon');
gulp.task('compass', function (done) {
gulp.src(['public/scss/**/*.scss', 'public/scss/**/*.sass'])
.pipe(compass({
config_file: './public/config.rb',
css: 'public/styles',
sass: 'public/scss'
}).on('error', function (err) {
console.error('Error!', err.message);
}))
.pipe(gulp.dest('public/styles'));
done();
});
gulp.task('watch', function () {
gulp.watch('public/scss/**/*.scss', gulp.series('compass'));
// gulp.watch('public/*.html', browserSync.reload);
// gulp.watch('public/*.htm', browserSync.reload);
// gulp.watch('public/js/**/*.js', browserSync.reload);
});
gulp.task('nodemon', function (cb) {
var started = false;
return nodemon({
script: './public/index.js'
}).on('start', function () {
// to avoid nodemon being started multiple times
// thanks @matthisk
if (!started) {
cb();
started = true;
}
});
});
gulp.task('browser-sync', gulp.series('nodemon' , function (done) {
bSync.init({
proxy: "http://localhost:3000",
files: ["public/**/*.*", "node_modules/**/*.*"],
browser: "firefox",
port: 7000
});
done();
}));
gulp.task('default', gulp.series('compass', 'browser-sync', 'watch'));