-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.babel.js
More file actions
47 lines (39 loc) · 1.16 KB
/
gulpfile.babel.js
File metadata and controls
47 lines (39 loc) · 1.16 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
import gulp from 'gulp';
import watch from 'gulp-watch';
import batch from 'gulp-batch';
import stylus from 'gulp-stylus';
import browserSync from 'browser-sync';
import childProcess from 'child_process';
import autoPrefixer from 'gulp-autoprefixer';
const bs = browserSync.create();
const spawn = childProcess.spawn;
let server = null;
gulp.task('stylus', (_) => {
return gulp.src('src/stylus/**/*.styl')
.pipe(stylus())
.pipe(autoPrefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(gulp.dest('dist/css'))
.pipe(bs.stream());
});
gulp.task('build', ['stylus']); // In case we want to easily add another build step
gulp.task('watch', (_) => {
return watch('src/stylus/**/*.styl', (_) => {
gulp.start('stylus');
});
});
gulp.task('serve', (_) => {
// Run the server
server = spawn('node', ['server.js']);
console.log('[Gulp] Spawned server...');
// Proxy for live-reload frame
bs.init({
proxy: 'localhost:3000', // Default for the server during development
port: 8080
});
console.log('[Gulp] Created Browser-Sync proxy...');
});
// Default to just development
gulp.task('default', ['serve', 'watch']);