-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
42 lines (33 loc) · 1 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
'use strict';
const Gulp = require('gulp');
const Sass = require('gulp-sass');
const Concat = require('gulp-concat');
const BrowserSync = require('browser-sync');
const Spawn = require('child_process').spawn;
const CONFIG = require('./config');
const ENVIRONMENT = process.env.NODE_ENV || 'DEVELOPMENT';
Gulp.task('default', ['dev']);
Gulp.task('dev', ['express', 'browser-sync', 'sass', 'sass:watch']);
// Browser-Sync
Gulp.task('browser-sync', _ => {
BrowserSync.init({
proxy: `localhost:${CONFIG[ENVIRONMENT].SERVER.PORT}`
});
});
// Express server
Gulp.task('express', _ => {
let options = { shell: true, stdio: "inherit" };
return Spawn('node', ['index.js'], options);
});
// SASS
Gulp.task('sass', _ => {
return Gulp.src('./server/scss/**/*.scss')
.pipe(Sass().on('error', Sass.logError))
.pipe(Concat('styles.css'))
.pipe(Gulp.dest('./server/public/css/'))
.pipe(BrowserSync.stream())
;
});
Gulp.task('sass:watch', _ => {
Gulp.watch('./server/scss/**/*.scss', ['sass']);
});